Skip to content

Commit

Permalink
freaking workaround for Flatpak bullcrap
Browse files Browse the repository at this point in the history
issue #2096

pass -DFLATPAK_WORKAROUNDS=ON to CMake when building Flatpak
  • Loading branch information
tildearrow committed Sep 29, 2024
1 parent df95939 commit 3eb0686
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ option(WITH_INSTRUMENTS "Install instruments" ON)
option(WITH_WAVETABLES "Install wavetables" ON)
option(SHOW_OPEN_ASSETS_MENU_ENTRY "Show option to open built-in assets directory (on supported platforms)" OFF)
option(CONSOLE_SUBSYSTEM "Build Furnace with Console subsystem on Windows" OFF)
option(FLATPAK_WORKAROUNDS "Enable Flatpak-specific workaround for system file picker" OFF)
if (APPLE)
option(FORCE_APPLE_BIN "Force enable binary installation to /bin" OFF)
option(MAKE_BUNDLE "Make a bundle" OFF)
Expand All @@ -159,6 +160,10 @@ if (IS_BIG_ENDIAN)
list(APPEND DEPENDENCIES_DEFINES "TA_BIG_ENDIAN")
endif()

if (FLATPAK_WORKAROUNDS)
list(APPEND DEPENDENCIES_DEFINES "FLATPAK_WORKAROUNDS")
endif()

set(DEPENDENCIES_COMPILE_OPTIONS "")
set(DEPENDENCIES_LIBRARIES "")
set(DEPENDENCIES_LIBRARY_DIRS "")
Expand Down
24 changes: 6 additions & 18 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2855,24 +2855,6 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
fileName+=x; \
}

#define checkExtensionDual(x,y,fallback) \
String lowerCase=fileName; \
for (char& i: lowerCase) { \
if (i>='A' && i<='Z') i+='a'-'A'; \
} \
if (lowerCase.size()<4 || (lowerCase.rfind(x)!=lowerCase.size()-4 && lowerCase.rfind(y)!=lowerCase.size()-4)) { \
fileName+=fallback; \
}

#define checkExtensionTriple(x,y,z,fallback) \
String lowerCase=fileName; \
for (char& i: lowerCase) { \
if (i>='A' && i<='Z') i+='a'-'A'; \
} \
if (lowerCase.size()<4 || (lowerCase.rfind(x)!=lowerCase.size()-4 && lowerCase.rfind(y)!=lowerCase.size()-4 && lowerCase.rfind(z)!=lowerCase.size()-4)) { \
fileName+=fallback; \
}

#define drawOpMask(m) \
ImGui::PushFont(patFont); \
ImGui::PushID("om_" #m); \
Expand Down Expand Up @@ -5146,7 +5128,13 @@ bool FurnaceGUI::loop() {
} else {
fileName=fileDialog->getFileName()[0];
}
#ifdef FLATPAK_WORKAROUNDS
// https://github.com/tildearrow/furnace/issues/2096
// Flatpak Portals mangling our path hinders us from adding extension
if (fileName!="" && !settings.sysFileDialog) {
#else
if (fileName!="") {
#endif
if (curFileDialog==GUI_FILE_SAVE) {
checkExtension(".fur");
}
Expand Down

0 comments on commit 3eb0686

Please sign in to comment.