[FS] Add app data folder, add path safety checks

This commit is contained in:
wheremyfoodat 2023-01-16 01:06:43 +02:00
parent c16bf5c8aa
commit b1f2be98fa
6 changed files with 77 additions and 12 deletions

View file

@ -5,6 +5,7 @@
#include <SDL.h>
#include "cpu.hpp"
#include "io_file.hpp"
#include "memory.hpp"
#include "opengl.hpp"
#include "PICA/gpu.hpp"
@ -43,6 +44,12 @@ public:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
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();
}