mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01:00
common: Support macOS application data path conventions. (#6258)
This commit is contained in:
parent
9b20bcea0f
commit
d704c6a3ac
@ -20,6 +20,10 @@
|
|||||||
#else
|
#else
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define EMU_DATA_DIR "Citra"
|
#define EMU_DATA_DIR "Citra"
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define MACOS_EMU_DATA_DIR "Library" DIR_SEP "Application Support" DIR_SEP "Citra"
|
||||||
|
// For compatibility with XDG paths.
|
||||||
|
#define EMU_DATA_DIR "citra-emu"
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
// On Android internal storage is mounted as "/sdcard"
|
// On Android internal storage is mounted as "/sdcard"
|
||||||
#define SDCARD_DIR "sdcard"
|
#define SDCARD_DIR "sdcard"
|
||||||
|
@ -709,13 +709,26 @@ void SetUserPath(const std::string& path) {
|
|||||||
g_paths.emplace(UserPath::ConfigDir, user_path + CONFIG_DIR DIR_SEP);
|
g_paths.emplace(UserPath::ConfigDir, user_path + CONFIG_DIR DIR_SEP);
|
||||||
g_paths.emplace(UserPath::CacheDir, user_path + CACHE_DIR DIR_SEP);
|
g_paths.emplace(UserPath::CacheDir, user_path + CACHE_DIR DIR_SEP);
|
||||||
} else {
|
} else {
|
||||||
std::string data_dir = GetUserDirectory("XDG_DATA_HOME");
|
std::string data_dir = GetUserDirectory("XDG_DATA_HOME") + DIR_SEP EMU_DATA_DIR DIR_SEP;
|
||||||
std::string config_dir = GetUserDirectory("XDG_CONFIG_HOME");
|
std::string config_dir =
|
||||||
std::string cache_dir = GetUserDirectory("XDG_CACHE_HOME");
|
GetUserDirectory("XDG_CONFIG_HOME") + DIR_SEP EMU_DATA_DIR DIR_SEP;
|
||||||
|
std::string cache_dir =
|
||||||
|
GetUserDirectory("XDG_CACHE_HOME") + DIR_SEP EMU_DATA_DIR DIR_SEP;
|
||||||
|
|
||||||
user_path = data_dir + DIR_SEP EMU_DATA_DIR DIR_SEP;
|
#if defined(__APPLE__)
|
||||||
g_paths.emplace(UserPath::ConfigDir, config_dir + DIR_SEP EMU_DATA_DIR DIR_SEP);
|
// If XDG directories don't already exist from a previous setup, use standard macOS
|
||||||
g_paths.emplace(UserPath::CacheDir, cache_dir + DIR_SEP EMU_DATA_DIR DIR_SEP);
|
// paths.
|
||||||
|
if (!FileUtil::Exists(data_dir) && !FileUtil::Exists(config_dir) &&
|
||||||
|
!FileUtil::Exists(cache_dir)) {
|
||||||
|
data_dir = GetHomeDirectory() + DIR_SEP MACOS_EMU_DATA_DIR DIR_SEP;
|
||||||
|
config_dir = data_dir + CONFIG_DIR DIR_SEP;
|
||||||
|
cache_dir = data_dir + CACHE_DIR DIR_SEP;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
user_path = data_dir;
|
||||||
|
g_paths.emplace(UserPath::ConfigDir, config_dir);
|
||||||
|
g_paths.emplace(UserPath::CacheDir, cache_dir);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user