Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
[linux] use SDL_GetPrefPath in Linux instead of SHGetKnownFolderPath
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed Jun 6, 2022
1 parent 288abec commit 6018ab6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libs/util/include/storm/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

#include <filesystem>

#ifdef _WIN32 // SHGetKnownFolderPath
#include <ShlObj.h>
#else
#include <SDL2/SDL.h>
#endif

/* Filesystem proxy */
namespace fs
Expand All @@ -14,11 +18,17 @@ inline path GetStashPath()
static path path;
if (path.empty())
{
#ifdef _WIN32 // SHGetKnownFolderPath
wchar_t *str = nullptr;
SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_SIMPLE_IDLIST, nullptr, &str);
path = str;
path = path / "My Games" / "Sea Dogs";
CoTaskMemFree(str);
#else
char *pref_path = nullptr;
pref_path = SDL_GetPrefPath("Akella", "Sea Dogs");
path = pref_path;
#endif
}
return path;
}
Expand Down

0 comments on commit 6018ab6

Please sign in to comment.