mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-06 06:30:33 -04:00
FIx detection of drive letter in windows path, use utf-8 for path #2
This commit is contained in:
parent
3152a44d35
commit
54d7d22734
3 changed files with 40 additions and 18 deletions
|
@ -15,13 +15,17 @@ std::string getSavedGamesDirectory() {
|
|||
PWSTR path = nullptr;
|
||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_SavedGames, 0, NULL, &path))) {
|
||||
fs::path savedGamesPath(path);
|
||||
CoTaskMemFree(path);
|
||||
return (savedGamesPath / SAVEGAME_FOLDERNAME).string();
|
||||
CoTaskMemFree(path);
|
||||
|
||||
// Převod na UTF-8 std::string
|
||||
std::u8string utf8 = (savedGamesPath / SAVEGAME_FOLDERNAME).u8string();
|
||||
return std::string(reinterpret_cast<const char*>(utf8.data()), utf8.size());
|
||||
} else {
|
||||
display_error("Failed to retrieve FOLDEROD_SavedGames");
|
||||
display_error("Failed to retrieve FOLDERID_SavedGames");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
const char *get_default_savegame_directory() {
|
||||
|
||||
static std::string dir = getSavedGamesDirectory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue