1.5: Fuckin' UE5... #38
2 changed files with 11 additions and 3 deletions
|
@ -198,9 +198,17 @@ SaveTool::findGameDataDirectory() -> bool {
|
||||||
|
|
||||||
wchar_t* localappdata_path = nullptr;
|
wchar_t* localappdata_path = nullptr;
|
||||||
Containers::ScopeGuard guard{localappdata_path, CoTaskMemFree};
|
Containers::ScopeGuard guard{localappdata_path, CoTaskMemFree};
|
||||||
if(SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_NO_APPCONTAINER_REDIRECTION, nullptr, &localappdata_path) != S_OK)
|
auto result = SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr, &localappdata_path);
|
||||||
|
if(result != S_OK)
|
||||||
{
|
{
|
||||||
_lastError = Utility::format("SHGetKnownFolderPath() failed with error code {}.", GetLastError());
|
char* message_buffer = nullptr;
|
||||||
|
auto size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
nullptr, result, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
|
||||||
|
reinterpret_cast<char*>(&message_buffer), 0, nullptr);
|
||||||
|
String message{message_buffer, size};
|
||||||
|
LocalFree(message_buffer);
|
||||||
|
|
||||||
|
_lastError = Utility::format("SHGetKnownFolderPath() failed with error code {}: {}", result, message);
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ int main(int argc, char** argv) {
|
||||||
Containers::StringView locale{str};
|
Containers::StringView locale{str};
|
||||||
LOG_INFO_FORMAT("Current locale: {}", locale);
|
LOG_INFO_FORMAT("Current locale: {}", locale);
|
||||||
|
|
||||||
if(!locale.hasSuffix(".utf8")) {
|
if(!locale.hasSuffix(".utf8") && !locale.hasSuffix(".65001")) {
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
|
||||||
"Your system doesn't support UTF-8.", nullptr);
|
"Your system doesn't support UTF-8.", nullptr);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
Loading…
Reference in a new issue