diff options
| author | Rukai <rubickent@gmail.com> | 2016-02-10 16:42:32 +1100 |
|---|---|---|
| committer | Rukai <rubickent@gmail.com> | 2016-07-04 19:39:10 +1000 |
| commit | f42350e719d20e9ef4fe03273f142a08f764ccbb (patch) | |
| tree | d546b954be4ad28967f1c8caa506e3fff1f893b0 /Source/Core | |
| parent | b33a5e25105fa065c8cfb559fca9d12b85136d81 (diff) | |
portable.txt enables portable configuration on linux, README updated to
show how to build a portable and a local dolphin on linux.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/UICommon/UICommon.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 0308fc42bd..7789a11743 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -78,8 +78,8 @@ void SetUserDirectory(const std::string& custom_path) std::string user_path = ""; #ifdef _WIN32 - // Detect where the User directory is. There are five different cases (on top of the - // command line flag, which overrides all this): + // Detect where the User directory is. There are five different cases + // (on top of the command line flag, which overrides all this): // 1. GetExeDirectory()\portable.txt exists // -> Use GetExeDirectory()\User // 2. HKCU\Software\Dolphin Emulator\LocalUserConfig exists and is true @@ -126,7 +126,8 @@ void SetUserDirectory(const std::string& custom_path) else // Case 5 user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; - // Prettify the path: it will be displayed in some places, we don't want a mix of \ and /. + // Prettify the path: it will be displayed in some places, we don't want a mix + // of \ and /. user_path = ReplaceAll(user_path, "\\", DIR_SEP); // Make sure it ends in DIR_SEP. @@ -149,12 +150,21 @@ void SetUserDirectory(const std::string& custom_path) #if defined(__APPLE__) || defined(ANDROID) user_path = home_path + DOLPHIN_DATA_DIR DIR_SEP; #else - // We are on a non-Apple and non-Android POSIX system, let's respect XDG basedir. - // The only case we don't is when there is an existing ~/.dolphin-emu directory. - // See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - + // We are on a non-Apple and non-Android POSIX system, there are 3 cases: + // 1. GetExeDirectory()/portable.txt exists + // -> Use GetExeDirectory/User + // 2. ~/.dolphin-emu directory exists + // -> Use ~/.dolphin-emu + // 3. Default + // -> Use XDG basedir, see + // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html user_path = home_path + "." DOLPHIN_DATA_DIR DIR_SEP; - if (!File::Exists(user_path)) + std::string exe_path = File::GetExeDirectory(); + if (File::Exists(exe_path + DIR_SEP "portable.txt")) + { + user_path = exe_path + DIR_SEP "User" DIR_SEP; + } + else if (!File::Exists(user_path)) { const char* data_home = getenv("XDG_DATA_HOME"); std::string data_path = |
