Add game folder to app data
This commit is contained in:
@@ -45,11 +45,6 @@ public:
|
||||
window = SDL_CreateWindow("Alber", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
|
||||
glContext = SDL_GL_CreateContext(window);
|
||||
|
||||
// Get path for saving files (AppData on Windows, /home/user/.local/share/ApplcationName on Linux, etc)
|
||||
char* appData = SDL_GetPrefPath(nullptr, "Alber");
|
||||
IOFile::setAppDataDir(appData);
|
||||
SDL_free(appData);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,9 +107,9 @@ public:
|
||||
return handle;
|
||||
}
|
||||
|
||||
static void setAppDataDir(const char* dir) {
|
||||
if (!dir) Helpers::panic("Failed to set app data directory");
|
||||
appData = std::filesystem::path(dir);
|
||||
static void setAppDataDir(const std::filesystem::path& dir) {
|
||||
if (dir == "") Helpers::panic("Failed to set app data directory");
|
||||
appData = dir;
|
||||
}
|
||||
|
||||
static std::filesystem::path getAppData() { return IOFile::appData; }
|
||||
|
||||
Reference in New Issue
Block a user