diff options
| author | Zach Hilman <zachhilman@gmail.com> | 2018-07-29 17:45:12 -0400 |
|---|---|---|
| committer | Zach Hilman <zachhilman@gmail.com> | 2018-08-01 00:16:54 -0400 |
| commit | e7ae26a56384a3a9333dec41605a36b5c9fa92c0 (patch) | |
| tree | c83060f2e045e20b84e8685519cddd804d19cf03 /src/common/file_util.cpp | |
| parent | 272ca87298f6440203d3de74766c49a6776ec700 (diff) | |
Use SHGetKnownFolderPath instead of SHGetFolderPathA
Diffstat (limited to 'src/common/file_util.cpp')
| -rw-r--r-- | src/common/file_util.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index a26702f54c..ed38c3ced2 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -738,10 +738,11 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) { std::string GetHactoolConfigurationPath() { #ifdef _WIN32 - char path[MAX_PATH]; - if (SHGetFolderPathA(nullptr, CSIDL_PROFILE, nullptr, 0, path) != S_OK) + PWSTR pw_local_path = nullptr; + if (SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &pw_local_path) != S_OK) 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"; #else return GetHomeDirectory() + "/.switch"; |
