diff --git a/source/fs.c b/source/fs.c index a2c9a54..9d092aa 100644 --- a/source/fs.c +++ b/source/fs.c @@ -291,6 +291,7 @@ bool PathDelete(const char* path) { bool PathRename(const char* path, const char* newname) { char npath[256]; // 256 is the maximum length of a full path char* oldname = strrchr(path, '/'); + if (!CheckWritePermissions(path)) return false; if (!oldname) return false; oldname++; strncpy(npath, path, oldname - path); @@ -300,6 +301,7 @@ bool PathRename(const char* path, const char* newname) { bool DirCreate(const char* cpath, const char* dirname) { char npath[256]; // 256 is the maximum length of a full path + if (!CheckWritePermissions(cpath)) return false; snprintf(npath, 255, "%s/%s", cpath, dirname); return (f_mkdir(npath) == FR_OK); } diff --git a/source/godmode.c b/source/godmode.c index 0f8abcc..cf28e34 100644 --- a/source/godmode.c +++ b/source/godmode.c @@ -270,7 +270,7 @@ u32 GodMode() { ClearScreenF(true, false, COLOR_STD_BG); } } else { // switched command set - if (pad_state & BUTTON_X) { // rename a file + if ((pad_state & BUTTON_X) && cursor) { // rename a file char newname[256]; char namestr[20+1]; TruncateString(namestr, current_dir->entry[cursor].name, 20, 12);