Skip to content

Commit

Permalink
Fix config load on windows with chinese user name
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonflylee committed Sep 1, 2024
1 parent cc06b89 commit c891b67
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wiliwili/source/utils/config_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#elif defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
#include <unistd.h>
#include <borealis/platforms/desktop/desktop_platform.hpp>
#if defined(_WIN32)
#include <shlobj.h>
#endif
#endif

#include <borealis/core/application.hpp>
Expand Down Expand Up @@ -904,7 +907,11 @@ std::string ProgramConfig::getConfigDir() {
return config + "/wiliwili";
#endif
#ifdef _WIN32
return std::string(getenv("LOCALAPPDATA")) + "\\xfangfang\\wiliwili";
WCHAR wpath[MAX_PATH];
std::vector<char> lpath(MAX_PATH);
SHGetSpecialFolderPathW(0, wpath, CSIDL_LOCAL_APPDATA, false);
WideCharToMultiByte(CP_UTF8, 0, wpath, std::wcslen(wpath), lpath.data(), lpath.size(), nullptr, nullptr);
return std::string(lpath.data()) + "\\xfangfang\\wiliwili";
#endif
#endif /* _DEBUG */
#endif /* __SWITCH__ */
Expand Down

0 comments on commit c891b67

Please sign in to comment.