diff options
author | freiro <f73b2894@opayq.com> | 2016-11-17 12:29:57 +0100 |
---|---|---|
committer | freiro <f73b2894@opayq.com> | 2016-11-19 15:50:16 +0100 |
commit | 3d75e3cd07a8c577d74aa1c7017c7ee5019e632d (patch) | |
tree | 99e6ce642a0406deaa87a4d4a283964a5ff9c10b /src/common/file_util.cpp | |
parent | Win32 move default user folder location to AppData (diff) | |
download | yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.tar yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.tar.gz yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.tar.bz2 yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.tar.lz yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.tar.xz yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.tar.zst yuzu-3d75e3cd07a8c577d74aa1c7017c7ee5019e632d.zip |
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r-- | src/common/file_util.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 8a8ff3092..a1c12cbce 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -598,18 +598,12 @@ std::string& GetExeDirectory() { return exe_path; } -std::string& AppDataLocalDirectory() { - // Windows Vista or later only - static std::string local_path; - if (local_path.empty()) { - PWSTR pw_local_path = 0; - wchar_t* wchar_local_path; - SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pw_local_path); - wchar_local_path = pw_local_path; - local_path = Common::UTF16ToUTF8(wchar_local_path); - // Freeing memory - CoTaskMemFree(static_cast<void*>(pw_local_path)); - } +std::string AppDataLocalDirectory() { + PWSTR pw_local_path = nullptr; + // Only supported by Windows Vista or later + SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pw_local_path); + std::string local_path = Common::UTF16ToUTF8(pw_local_path); + CoTaskMemFree(pw_local_path); return local_path; } #else @@ -691,7 +685,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; if (!FileUtil::IsDirectory(paths[D_USER_IDX])) { paths[D_USER_IDX] = - AppDataLocalDirectory() + DIR_SEP + EMU_DATA_DIR DIR_SEP USERDATA_DIR DIR_SEP; + AppDataLocalDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP USERDATA_DIR DIR_SEP; } paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; |