UICommon: Change default User directory location to AppData
This commit is contained in:
parent
c4f4ecbb62
commit
75d87ff90e
|
@ -289,8 +289,8 @@ void SetUserDirectory(std::string custom_path)
|
|||
// -> Use GetExeDirectory()\User
|
||||
// 3. HKCU\Software\Dolphin Emulator\UserConfigPath exists
|
||||
// -> Use this as the user directory path
|
||||
// 4. My Documents exists
|
||||
// -> Use My Documents\Dolphin Emulator as the User directory path
|
||||
// 4. AppData\Roaming exists
|
||||
// -> Use AppData\Roaming\Dolphin Emulator as the User directory path
|
||||
// 5. Default
|
||||
// -> Use GetExeDirectory()\User
|
||||
|
||||
|
@ -323,22 +323,22 @@ void SetUserDirectory(std::string custom_path)
|
|||
|
||||
local = local != 0 || File::Exists(File::GetExeDirectory() + DIR_SEP "portable.txt");
|
||||
|
||||
// Get Documents path in case we need it.
|
||||
// Get AppData path in case we need it.
|
||||
// TODO: Maybe use WIL when it's available?
|
||||
PWSTR my_documents = nullptr;
|
||||
bool my_documents_found =
|
||||
SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_DEFAULT, nullptr, &my_documents));
|
||||
PWSTR appdata = nullptr;
|
||||
bool appdata_found =
|
||||
SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DEFAULT, nullptr, &appdata));
|
||||
|
||||
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 (my_documents_found) // Case 4
|
||||
user_path = TStrToUTF8(my_documents) + DIR_SEP "Dolphin Emulator" DIR_SEP;
|
||||
else if (appdata_found) // Case 4
|
||||
user_path = TStrToUTF8(appdata) + DIR_SEP "Dolphin Emulator" DIR_SEP;
|
||||
else // Case 5
|
||||
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
|
||||
CoTaskMemFree(my_documents);
|
||||
CoTaskMemFree(appdata);
|
||||
#else
|
||||
if (File::IsDirectory(ROOT_DIR DIR_SEP USERDATA_DIR))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue