CommonPaths: Split PORTABLE_USER_DIR into "portable" and "embedded" to accomodate macOS

This commit is contained in:
OatmealDome 2023-01-17 14:17:10 -05:00
parent 7f962a4146
commit af33d4f13f
2 changed files with 7 additions and 8 deletions

View File

@ -7,23 +7,22 @@
#define DIR_SEP "/" #define DIR_SEP "/"
#define DIR_SEP_CHR '/' #define DIR_SEP_CHR '/'
// The user data dir
#define ROOT_DIR "." #define ROOT_DIR "."
#ifdef _WIN32 #ifdef _WIN32
#define PORTABLE_USER_DIR "User" #define PORTABLE_USER_DIR "User"
#define NORMAL_USER_DIR "Dolphin Emulator" #define NORMAL_USER_DIR "Dolphin Emulator"
#elif defined __APPLE__ #elif defined __APPLE__
// On OS X, PORTABLE_USER_DIR exists within the .app, but *always* reference #define PORTABLE_USER_DIR "User"
// the copy in Application Support instead! (Copied on first run) #define EMBEDDED_USER_DIR "Contents/Resources/User"
// You can use the File::GetUserPath() util for this
#define PORTABLE_USER_DIR "Contents/Resources/User"
#define NORMAL_USER_DIR "Library/Application Support/Dolphin" #define NORMAL_USER_DIR "Library/Application Support/Dolphin"
#elif defined ANDROID #elif defined ANDROID
#define PORTABLE_USER_DIR "user" #define PORTABLE_USER_DIR "user"
#define EMBEDDED_USER_DIR PORTABLE_USER_DIR
#define NORMAL_USER_DIR "/sdcard/dolphin-emu" #define NORMAL_USER_DIR "/sdcard/dolphin-emu"
#define NOMEDIA_FILE ".nomedia" #define NOMEDIA_FILE ".nomedia"
#else #else
#define PORTABLE_USER_DIR "user" #define PORTABLE_USER_DIR "user"
#define EMBEDDED_USER_DIR PORTABLE_USER_DIR
#define NORMAL_USER_DIR "dolphin-emu" #define NORMAL_USER_DIR "dolphin-emu"
#endif #endif

View File

@ -376,9 +376,9 @@ void SetUserDirectory(std::string custom_path)
CoTaskMemFree(appdata); CoTaskMemFree(appdata);
CoTaskMemFree(documents); CoTaskMemFree(documents);
#else #else
if (File::IsDirectory(ROOT_DIR DIR_SEP PORTABLE_USER_DIR)) if (File::IsDirectory(ROOT_DIR DIR_SEP EMBEDDED_USER_DIR))
{ {
user_path = ROOT_DIR DIR_SEP PORTABLE_USER_DIR DIR_SEP; user_path = ROOT_DIR DIR_SEP EMBEDDED_USER_DIR DIR_SEP;
} }
else else
{ {
@ -412,7 +412,7 @@ void SetUserDirectory(std::string custom_path)
std::string exe_path = File::GetExeDirectory(); std::string exe_path = File::GetExeDirectory();
if (File::Exists(exe_path + DIR_SEP "portable.txt")) if (File::Exists(exe_path + DIR_SEP "portable.txt"))
{ {
user_path = exe_path + DIR_SEP "User" DIR_SEP; user_path = exe_path + DIR_SEP PORTABLE_USER_DIR DIR_SEP;
} }
else if (env_path) else if (env_path)
{ {