mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Safety checks for dummy file / dir creation
This commit is contained in:
parent
bc5f187a0f
commit
6a04bfca67
@ -367,14 +367,15 @@ bool FileCreateDummy(const char* cpath, const char* filename, u64 size) {
|
|||||||
f_sync(&dfile);
|
f_sync(&dfile);
|
||||||
fx_close(&dfile);
|
fx_close(&dfile);
|
||||||
|
|
||||||
return true;
|
return (fa_stat(npath, NULL) == FR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirCreate(const char* cpath, const char* dirname) {
|
bool DirCreate(const char* cpath, const char* dirname) {
|
||||||
char npath[256]; // 256 is the maximum length of a full path
|
char npath[256]; // 256 is the maximum length of a full path
|
||||||
if (!CheckWritePermissions(cpath)) return false;
|
if (!CheckWritePermissions(cpath)) return false;
|
||||||
snprintf(npath, 255, "%s/%s", cpath, dirname);
|
snprintf(npath, 255, "%s/%s", cpath, dirname);
|
||||||
return (fa_mkdir(npath) == FR_OK);
|
if (fa_mkdir(npath) != FR_OK) return false;
|
||||||
|
return (fa_stat(npath, NULL) == FR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirInfoWorker(char* fpath, bool virtual, u64* tsize, u32* tdirs, u32* tfiles) {
|
bool DirInfoWorker(char* fpath, bool virtual, u64* tsize, u32* tdirs, u32* tfiles) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user