freaking workaround for Flatpak bullcrap

issue #2096

pass -DFLATPAK_WORKAROUNDS=ON to CMake when building Flatpak
This commit is contained in:
tildearrow 2024-09-29 17:03:39 -05:00
parent df959399cd
commit 3eb0686c1c
2 changed files with 11 additions and 18 deletions

View file

@ -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)
@ -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 "")

View file

@ -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); \
@ -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");
}