1
0
Fork 0
forked from suyu/suyu

add a compile time option to allow disabling portable mode

This commit is contained in:
xcfrg 2023-09-06 18:53:39 -04:00
parent c24ed3ecaf
commit a02d641042
No known key found for this signature in database
GPG key ID: 82723C9507F7F937
3 changed files with 10 additions and 2 deletions

View file

@ -61,6 +61,8 @@ option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" OFF) option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" OFF)
option(YUZU_ENABLE_PORTABLE "Allow yuzu to enable portable mode if a user folder is found in the CWD" ON)
CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF)
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF) CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF)

View file

@ -151,6 +151,10 @@ add_library(common STATIC
zstd_compression.h zstd_compression.h
) )
if (YUZU_ENABLE_PORTABLE)
add_compile_definitions(YUZU_ENABLE_PORTABLE)
endif()
if (WIN32) if (WIN32)
target_sources(common PRIVATE target_sources(common PRIVATE
windows/timer_resolution.cpp windows/timer_resolution.cpp

View file

@ -88,8 +88,9 @@ public:
fs::path yuzu_path_config; fs::path yuzu_path_config;
#ifdef _WIN32 #ifdef _WIN32
#ifdef YUZU_ENABLE_PORTABLE
yuzu_path = GetExeDirectory() / PORTABLE_DIR; yuzu_path = GetExeDirectory() / PORTABLE_DIR;
#endif
if (!IsDir(yuzu_path)) { if (!IsDir(yuzu_path)) {
yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
} }
@ -101,8 +102,9 @@ public:
yuzu_path_cache = yuzu_path / CACHE_DIR; yuzu_path_cache = yuzu_path / CACHE_DIR;
yuzu_path_config = yuzu_path / CONFIG_DIR; yuzu_path_config = yuzu_path / CONFIG_DIR;
#else #else
#ifdef YUZU_ENABLE_PORTABLE
yuzu_path = GetCurrentDir() / PORTABLE_DIR; yuzu_path = GetCurrentDir() / PORTABLE_DIR;
#endif
if (Exists(yuzu_path) && IsDir(yuzu_path)) { if (Exists(yuzu_path) && IsDir(yuzu_path)) {
yuzu_path_cache = yuzu_path / CACHE_DIR; yuzu_path_cache = yuzu_path / CACHE_DIR;
yuzu_path_config = yuzu_path / CONFIG_DIR; yuzu_path_config = yuzu_path / CONFIG_DIR;