mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-11-01 21:07:52 +00:00
Use SHGetKnownFolderPath instead of SHGetFolderPathA
This commit is contained in:
parent
239a3113e4
commit
cc8234fa89
1 changed files with 4 additions and 3 deletions
|
@ -738,10 +738,11 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) {
|
||||||
|
|
||||||
std::string GetHactoolConfigurationPath() {
|
std::string GetHactoolConfigurationPath() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char path[MAX_PATH];
|
PWSTR pw_local_path = nullptr;
|
||||||
if (SHGetFolderPathA(nullptr, CSIDL_PROFILE, nullptr, 0, path) != S_OK)
|
if (SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &pw_local_path) != S_OK)
|
||||||
return "";
|
return "";
|
||||||
std::string local_path = Common::StringFromFixedZeroTerminatedBuffer(path, MAX_PATH);
|
std::string local_path = Common::UTF16ToUTF8(pw_local_path);
|
||||||
|
CoTaskMemFree(pw_local_path);
|
||||||
return local_path + "\\.switch";
|
return local_path + "\\.switch";
|
||||||
#else
|
#else
|
||||||
return GetHomeDirectory() + "/.switch";
|
return GetHomeDirectory() + "/.switch";
|
||||||
|
|
Loading…
Reference in a new issue