mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
Added ability to create folders
This commit is contained in:
parent
7fea4e81b0
commit
1debcaeecc
@ -298,6 +298,12 @@ bool PathRename(const char* path, const char* newname) {
|
|||||||
return (f_rename(path, npath) == FR_OK);
|
return (f_rename(path, npath) == FR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DirCreate(const char* cpath, const char* dirname) {
|
||||||
|
char npath[256]; // 256 is the maximum length of a full path
|
||||||
|
snprintf(npath, 255, "%s/%s", cpath, dirname);
|
||||||
|
return (f_mkdir(npath) == FR_OK);
|
||||||
|
}
|
||||||
|
|
||||||
void CreateScreenshot() {
|
void CreateScreenshot() {
|
||||||
const u8 bmp_header[54] = {
|
const u8 bmp_header[54] = {
|
||||||
0x42, 0x4D, 0x36, 0xCA, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
|
0x42, 0x4D, 0x36, 0xCA, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
|
||||||
|
@ -52,6 +52,9 @@ bool PathDelete(const char* path);
|
|||||||
/** Rename file / folder in path to new name **/
|
/** Rename file / folder in path to new name **/
|
||||||
bool PathRename(const char* path, const char* newname);
|
bool PathRename(const char* path, const char* newname);
|
||||||
|
|
||||||
|
/** Create a new directory in cpath **/
|
||||||
|
bool DirCreate(const char* cpath, const char* dirname);
|
||||||
|
|
||||||
/** Create a screenshot of the current framebuffer **/
|
/** Create a screenshot of the current framebuffer **/
|
||||||
void CreateScreenshot();
|
void CreateScreenshot();
|
||||||
|
|
||||||
|
@ -283,7 +283,13 @@ u32 GodMode() {
|
|||||||
} else if (pad_state & BUTTON_Y) { // create a folder
|
} else if (pad_state & BUTTON_Y) { // create a folder
|
||||||
char dirname[256];
|
char dirname[256];
|
||||||
snprintf(dirname, 255, "newdir");
|
snprintf(dirname, 255, "newdir");
|
||||||
ShowInputPrompt(dirname, 256, "Create a new folder here?\nEnter name below.");
|
if (ShowInputPrompt(dirname, 256, "Create a new folder here?\nEnter name below.")) {
|
||||||
|
if (!DirCreate(current_path, dirname)) {
|
||||||
|
char namestr[20+1];
|
||||||
|
TruncateString(namestr, current_dir->entry[cursor].name, 20, 12);
|
||||||
|
ShowPrompt(false, "Failed creating dir:\n%s", namestr);
|
||||||
|
} else GetDirContents(current_dir, current_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user