Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix missing support for portable configuration files #11300

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion UI/cmake/os-linux.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
target_sources(obs-studio PRIVATE platform-x11.cpp)
target_compile_definitions(obs-studio PRIVATE USE_XDG OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}")
target_compile_definitions(
obs-studio
PRIVATE USE_XDG OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}" $<$<BOOL:${ENABLE_PORTABLE_CONFIG}>:ENABLE_PORTABLE_CONFIG>
)
target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate Qt::DBus)

target_sources(obs-studio PRIVATE system-info-posix.cpp)
Expand Down
26 changes: 19 additions & 7 deletions UI/obs-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,24 @@ bool OBSApp::InitGlobalConfig()
InitGlobalConfigDefaults();
InitGlobalLocationDefaults();

userConfigLocation = std::filesystem::u8path(
config_get_string(appConfig, "Locations", "Configuration"));
userScenesLocation = std::filesystem::u8path(
config_get_string(appConfig, "Locations", "SceneCollections"));
userProfilesLocation = std::filesystem::u8path(
config_get_string(appConfig, "Locations", "Profiles"));
if (IsPortableMode()) {
userConfigLocation = std::filesystem::u8path(
config_get_default_string(appConfig, "Locations",
"Configuration"));
userScenesLocation = std::filesystem::u8path(
config_get_default_string(appConfig, "Locations",
"SceneCollections"));
userProfilesLocation = std::filesystem::u8path(
config_get_default_string(appConfig, "Locations",
"Profiles"));
} else {
userConfigLocation = std::filesystem::u8path(config_get_string(
appConfig, "Locations", "Configuration"));
userScenesLocation = std::filesystem::u8path(config_get_string(
appConfig, "Locations", "SceneCollections"));
userProfilesLocation = std::filesystem::u8path(
config_get_string(appConfig, "Locations", "Profiles"));
}

bool userConfigResult = InitUserConfig(userConfigLocation, lastVersion);

Expand Down Expand Up @@ -2434,7 +2446,7 @@ static void load_debug_privilege(void)

#define CONFIG_PATH BASE_PATH "/config"

#if defined(LINUX_PORTABLE) || defined(_WIN32)
#if defined(ENABLE_PORTABLE_CONFIG) || defined(_WIN32)
#define ALLOW_PORTABLE_MODE 1
#else
#define ALLOW_PORTABLE_MODE 0
Expand Down
1 change: 1 addition & 0 deletions cmake/linux/defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
option(ENABLE_WAYLAND "Enable building with support for Wayland" ON)

option(ENABLE_RELOCATABLE "Enable relocatable build" OFF)
option(ENABLE_PORTABLE_CONFIG "Enable support for portable config file location" OFF)

# Set default installation directories
include(GNUInstallDirs)
Expand Down
Loading