mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 20:28:56 +00:00
Merge branch 'dolphin-mpn' into master
This commit is contained in:
commit
f3669dbbd4
903 changed files with 4243 additions and 386 deletions
|
@ -339,60 +339,11 @@ void SetUserDirectory(std::string custom_path)
|
|||
|
||||
local = local != 0 || File::Exists(File::GetExeDirectory() + DIR_SEP "portable.txt");
|
||||
|
||||
// Attempt to check if the old User directory exists in Documents.
|
||||
wil::unique_cotaskmem_string documents;
|
||||
bool documents_found = SUCCEEDED(
|
||||
SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_DEFAULT, nullptr, documents.put()));
|
||||
// Get Documents path in case we need it.
|
||||
// TODO: Maybe use WIL when it's available?
|
||||
PWSTR my_documents = nullptr;
|
||||
|
||||
std::optional<std::string> old_user_folder;
|
||||
if (documents_found)
|
||||
{
|
||||
old_user_folder = TStrToUTF8(documents.get()) + DIR_SEP NORMAL_USER_DIR DIR_SEP;
|
||||
}
|
||||
|
||||
if (local) // Case 1-2
|
||||
{
|
||||
user_path = File::GetExeDirectory() + DIR_SEP PORTABLE_USER_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.get()) + DIR_SEP NORMAL_USER_DIR 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 PORTABLE_USER_DIR DIR_SEP;
|
||||
}
|
||||
#else // ifndef STEAM
|
||||
if (File::Exists(File::GetExeDirectory() + DIR_SEP "portable.txt")) // Case 1
|
||||
{
|
||||
user_path = File::GetExeDirectory() + DIR_SEP PORTABLE_USER_DIR DIR_SEP;
|
||||
}
|
||||
else if (appdata_found) // Case 2
|
||||
{
|
||||
user_path = TStrToUTF8(appdata.get()) + DIR_SEP NORMAL_USER_DIR DIR_SEP;
|
||||
}
|
||||
else // Case 3
|
||||
{
|
||||
user_path = File::GetExeDirectory() + DIR_SEP PORTABLE_USER_DIR DIR_SEP;
|
||||
}
|
||||
#endif
|
||||
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
|
||||
#else
|
||||
if (File::IsDirectory(ROOT_DIR DIR_SEP EMBEDDED_USER_DIR))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue