Sfoglia il codice sorgente

UI: Fix configuration path handling for Linux portable builds

Original code uses simple `ifdef` pattern as well using the preprocessor
definition in a conditional check. With the rework, the definition was
set to an empty string (if the build flag is not enabled), which leads
to it being evaluated as "true" all the time.

This change uses simpler definition check and fences off code relying
on the flag being enabled.
PatTheMav 3 anni fa
parent
commit
55b23a26d2
1 ha cambiato i file con 10 aggiunte e 6 eliminazioni
  1. 10 6
      UI/obs-app.cpp

+ 10 - 6
UI/obs-app.cpp

@@ -2347,13 +2347,10 @@ static void load_debug_privilege(void)
 
 #define CONFIG_PATH BASE_PATH "/config"
 
-#ifndef LINUX_PORTABLE
-#define LINUX_PORTABLE 0
-#endif
-
 int GetConfigPath(char *path, size_t size, const char *name)
 {
-	if (LINUX_PORTABLE && portable_mode) {
+#ifdef LINUX_PORTABLE
+	if (portable_mode) {
 		if (name && *name) {
 			return snprintf(path, size, CONFIG_PATH "/%s", name);
 		} else {
@@ -2362,11 +2359,15 @@ int GetConfigPath(char *path, size_t size, const char *name)
 	} else {
 		return os_get_config_path(path, size, name);
 	}
+#else
+	return os_get_config_path(path, size, name);
+#endif
 }
 
 char *GetConfigPathPtr(const char *name)
 {
-	if (LINUX_PORTABLE && portable_mode) {
+#ifdef LINUX_PORTABLE
+	if (portable_mode) {
 		char path[512];
 
 		if (snprintf(path, sizeof(path), CONFIG_PATH "/%s", name) > 0) {
@@ -2377,6 +2378,9 @@ char *GetConfigPathPtr(const char *name)
 	} else {
 		return os_get_config_path_ptr(name);
 	}
+#else
+	return os_get_config_path_ptr(name);
+#endif
 }
 
 int GetProgramDataPath(char *path, size_t size, const char *name)