mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-05 15:52:45 +02:00
[user] prioritize 'user' directory if it exists (without needing a portable build) + docs (#338)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/338 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
@@ -117,8 +117,6 @@ option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
|
||||
|
||||
option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" ON)
|
||||
|
||||
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(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF)
|
||||
|
11
docs/User.md
Normal file
11
docs/User.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# User configuration
|
||||
|
||||
## Configuration directories
|
||||
|
||||
Eden will store configuration in the following directories:
|
||||
|
||||
- **Windows**: `%AppData%\Roaming`.
|
||||
- **Android**: Data is stored internally.
|
||||
- **Linux, macOS, FreeBSD, Solaris, OpenBSD**: `$XDG_DATA_HOME`, `$XDG_CACHE_HOME`, `$XDG_CONFIG_HOME`.
|
||||
|
||||
If a `user` directory is present in the current working directory, that will override all global configuration directories and the emulator will use that instead.
|
@@ -162,10 +162,6 @@ add_library(
|
||||
zstd_compression.h
|
||||
)
|
||||
|
||||
if(YUZU_ENABLE_PORTABLE)
|
||||
add_compile_definitions(YUZU_ENABLE_PORTABLE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_sources(common PRIVATE windows/timer_resolution.cpp
|
||||
windows/timer_resolution.h)
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#define PORTABLE_DIR "user"
|
||||
|
||||
// Sub-directories contained within a yuzu data directory
|
||||
|
||||
#define AMIIBO_DIR "amiibo"
|
||||
#define CACHE_DIR "cache"
|
||||
#define CONFIG_DIR "config"
|
||||
@@ -28,11 +27,12 @@
|
||||
#define SHADER_DIR "shader"
|
||||
#define TAS_DIR "tas"
|
||||
#define ICONS_DIR "icons"
|
||||
|
||||
// Compatibility with other emulators
|
||||
#define CITRON_DIR "citron"
|
||||
#define SUDACHI_DIR "sudachi"
|
||||
#define YUZU_DIR "yuzu"
|
||||
#define SUYU_DIR "suyu"
|
||||
|
||||
// yuzu-specific files
|
||||
|
||||
#define LOG_FILE "eden_log.txt"
|
||||
|
@@ -101,61 +101,53 @@ public:
|
||||
legacy_paths.insert_or_assign(legacy_path, new_path);
|
||||
}
|
||||
|
||||
/// In non-android devices, the current directory will first search for "user"
|
||||
/// if such directory (and it must be a directory) is found, that takes priority
|
||||
/// over the global configuration directory (in other words, portable directories
|
||||
/// take priority over the global ones, always)
|
||||
/// On Android, the behaviour is to look for the current directory only.
|
||||
void Reinitialize(fs::path eden_path = {}) {
|
||||
fs::path eden_path_cache;
|
||||
fs::path eden_path_config;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef YUZU_ENABLE_PORTABLE
|
||||
// User directory takes priority over global %AppData% directory
|
||||
eden_path = GetExeDirectory() / PORTABLE_DIR;
|
||||
#endif
|
||||
if (!IsDir(eden_path)) {
|
||||
if (!Exists(eden_path) || !IsDir(eden_path)) {
|
||||
eden_path = GetAppDataRoamingDirectory() / EDEN_DIR;
|
||||
}
|
||||
|
||||
eden_path_cache = eden_path / CACHE_DIR;
|
||||
eden_path_config = eden_path / CONFIG_DIR;
|
||||
|
||||
#define LEGACY_PATH(titleName, upperName) GenerateLegacyPath(LegacyPath::titleName##Dir, GetAppDataRoamingDirectory() / upperName##_DIR); \
|
||||
GenerateLegacyPath(LegacyPath::titleName##ConfigDir, GetAppDataRoamingDirectory() / upperName##_DIR / CONFIG_DIR); \
|
||||
GenerateLegacyPath(LegacyPath::titleName##CacheDir, GetAppDataRoamingDirectory() / upperName##_DIR / CACHE_DIR);
|
||||
|
||||
LEGACY_PATH(Citron, CITRON)
|
||||
LEGACY_PATH(Sudachi, SUDACHI)
|
||||
LEGACY_PATH(Yuzu, YUZU)
|
||||
LEGACY_PATH(Suyu, SUYU)
|
||||
#undef LEGACY_PATH
|
||||
|
||||
#elif ANDROID
|
||||
ASSERT(!eden_path.empty());
|
||||
eden_path_cache = eden_path / CACHE_DIR;
|
||||
eden_path_config = eden_path / CONFIG_DIR;
|
||||
#else
|
||||
#ifdef YUZU_ENABLE_PORTABLE
|
||||
eden_path = GetCurrentDir() / PORTABLE_DIR;
|
||||
#endif
|
||||
if (Exists(eden_path) && IsDir(eden_path)) {
|
||||
eden_path_cache = eden_path / CACHE_DIR;
|
||||
eden_path_config = eden_path / CONFIG_DIR;
|
||||
} else {
|
||||
if (!Exists(eden_path) || !IsDir(eden_path)) {
|
||||
eden_path = GetDataDirectory("XDG_DATA_HOME") / EDEN_DIR;
|
||||
eden_path_cache = GetDataDirectory("XDG_CACHE_HOME") / EDEN_DIR;
|
||||
eden_path_config = GetDataDirectory("XDG_CONFIG_HOME") / EDEN_DIR;
|
||||
} else {
|
||||
eden_path_cache = eden_path / CACHE_DIR;
|
||||
eden_path_config = eden_path / CONFIG_DIR;
|
||||
}
|
||||
|
||||
#define LEGACY_PATH(titleName, upperName) GenerateLegacyPath(LegacyPath::titleName##Dir, GetDataDirectory("XDG_DATA_HOME") / upperName##_DIR); \
|
||||
GenerateLegacyPath(LegacyPath::titleName##ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / upperName##_DIR); \
|
||||
GenerateLegacyPath(LegacyPath::titleName##CacheDir, GetDataDirectory("XDG_CACHE_HOME") / upperName##_DIR);
|
||||
|
||||
LEGACY_PATH(Citron, CITRON)
|
||||
LEGACY_PATH(Sudachi, SUDACHI)
|
||||
LEGACY_PATH(Yuzu, YUZU)
|
||||
LEGACY_PATH(Suyu, SUYU)
|
||||
|
||||
#undef LEGACY_PATH
|
||||
|
||||
#endif
|
||||
|
||||
GenerateEdenPath(EdenPath::EdenDir, eden_path);
|
||||
GenerateEdenPath(EdenPath::AmiiboDir, eden_path / AMIIBO_DIR);
|
||||
GenerateEdenPath(EdenPath::CacheDir, eden_path_cache);
|
||||
|
Reference in New Issue
Block a user