summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorOatmealDome <julian@oatmealdome.me>2022-05-29 19:20:41 -0400
committerOatmealDome <julian@oatmealdome.me>2023-01-16 01:37:14 -0500
commitcc68d5321f2986407a00e66635bf2cd512a60940 (patch)
tree88921c8158cfb64ccaeb356fafa182dc3b6797b8 /Source
parent3896934d5ee153c4dbbf435ed6dc480165676b6c (diff)
UICommon: Set UserConfigPath in the registry to AppData User for backwards compatibility
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/UICommon/UICommon.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp
index b2a16918b0..96e469d0aa 100644
--- a/Source/Core/UICommon/UICommon.cpp
+++ b/Source/Core/UICommon/UICommon.cpp
@@ -344,15 +344,34 @@ void SetUserDirectory(std::string custom_path)
}
if (local) // Case 1-2
+ {
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
+ }
else if (configPath) // Case 3
+ {
user_path = TStrToUTF8(configPath.get());
+ }
else if (old_user_folder && File::Exists(old_user_folder.value())) // Case 4
+ {
user_path = old_user_folder.value();
+ }
else if (appdata_found) // Case 5
+ {
user_path = TStrToUTF8(appdata) + DIR_SEP "Dolphin Emulator" DIR_SEP;
+
+ // Set the UserConfigPath value in the registry for backwards compatibility with older Dolphin
+ // builds, which will look for the default User directory in Documents. If we set this key,
+ // they will use this as the User directory instead.
+ // (If we're in this case, then this key doesn't exist, so it's OK to set it.)
+ std::wstring wstr_path = UTF8ToWString(user_path);
+ RegSetKeyValueW(HKEY_CURRENT_USER, TEXT("Software\\Dolphin Emulator"), TEXT("UserConfigPath"),
+ REG_SZ, wstr_path.c_str(),
+ static_cast<DWORD>((wstr_path.size() + 1) * sizeof(wchar_t)));
+ }
else // Case 6
+ {
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
+ }
CoTaskMemFree(appdata);
CoTaskMemFree(documents);