mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-07 11:31:39 +12:00
[FS] Add app data folder, add path safety checks
This commit is contained in:
parent
c16bf5c8aa
commit
b1f2be98fa
6 changed files with 77 additions and 12 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
class IOFile {
|
||||
FILE* handle = nullptr;
|
||||
static inline std::filesystem::path appData = ""; // Directory for holding app data. AppData on Windows
|
||||
|
||||
public:
|
||||
bool isOpen() {
|
||||
|
@ -81,4 +82,11 @@ public:
|
|||
bool rewind() {
|
||||
return seek(0, SEEK_SET);
|
||||
}
|
||||
|
||||
static void setAppDataDir(const char* dir) {
|
||||
if (!dir) Helpers::panic("Failed to set app data directory");
|
||||
appData = std::filesystem::path(dir);
|
||||
}
|
||||
|
||||
static std::filesystem::path getAppData() { return IOFile::appData; }
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue