mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Have R+X rename a file, instead of pressing A on a file
This commit is contained in:
parent
d6ca3e7dfd
commit
c8c3adf709
@ -229,9 +229,6 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
|||||||
assignedOp[maxCursors] = 2;
|
assignedOp[maxCursors] = 2;
|
||||||
printf(" Copy to fat:/gm9i/out\n");
|
printf(" Copy to fat:/gm9i/out\n");
|
||||||
}
|
}
|
||||||
maxCursors++;
|
|
||||||
assignedOp[maxCursors] = 4;
|
|
||||||
printf(" Rename file\n");
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("(<A> select, <B> cancel)");
|
printf("(<A> select, <B> cancel)");
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -302,20 +299,6 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
|||||||
nitroSecondaryDrive = secondaryDrive;
|
nitroSecondaryDrive = secondaryDrive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (assignedOp[optionOffset] == 4) {
|
|
||||||
consoleDemoInit();
|
|
||||||
Keyboard *kbd = keyboardDemoInit();
|
|
||||||
char newName[256];
|
|
||||||
kbd->OnKeyPressed = OnKeyPressed;
|
|
||||||
|
|
||||||
keyboardShow();
|
|
||||||
printf("Rename to: ");
|
|
||||||
iscanf("%s", newName);
|
|
||||||
keyboardHide();
|
|
||||||
consoleClear();
|
|
||||||
|
|
||||||
rename(entry->name.c_str(), newName);
|
|
||||||
}
|
|
||||||
return assignedOp[optionOffset];
|
return assignedOp[optionOffset];
|
||||||
}
|
}
|
||||||
if (pressed & KEY_B) {
|
if (pressed & KEY_B) {
|
||||||
@ -410,7 +393,7 @@ void fileBrowse_drawBottomScreen(DirEntry* entry, int fileOffset) {
|
|||||||
printf ("\x1b[23;0H");
|
printf ("\x1b[23;0H");
|
||||||
printf (titleName);
|
printf (titleName);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf ("X - DELETE file");
|
printf ("X - DELETE/[+R] RENAME file");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf (clipboardOn ? "Y - PASTE file" : "Y - COPY file");
|
printf (clipboardOn ? "Y - PASTE file" : "Y - COPY file");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
@ -547,7 +530,7 @@ string browseForFile (void) {
|
|||||||
if (getOp == 0) {
|
if (getOp == 0) {
|
||||||
// Return the chosen file
|
// Return the chosen file
|
||||||
return entry->name;
|
return entry->name;
|
||||||
} else if (getOp == 1 || getOp == 2 || (getOp == 3 && nitroMounted) || getOp == 4) {
|
} else if (getOp == 1 || getOp == 2 || (getOp == 3 && nitroMounted)) {
|
||||||
getDirectoryContents (dirContents); // Refresh directory listing
|
getDirectoryContents (dirContents); // Refresh directory listing
|
||||||
if (getOp == 3 && nitroMounted) {
|
if (getOp == 3 && nitroMounted) {
|
||||||
screenOffset = 0;
|
screenOffset = 0;
|
||||||
@ -569,6 +552,27 @@ string browseForFile (void) {
|
|||||||
fileOffset = 0;
|
fileOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename file/folder
|
||||||
|
if ((held & KEY_R) && (pressed & KEY_X)) {
|
||||||
|
pressed = 0;
|
||||||
|
consoleDemoInit();
|
||||||
|
Keyboard *kbd = keyboardDemoInit();
|
||||||
|
char newName[256];
|
||||||
|
kbd->OnKeyPressed = OnKeyPressed;
|
||||||
|
|
||||||
|
keyboardShow();
|
||||||
|
printf("Rename to: \n");
|
||||||
|
iscanf("%s", newName);
|
||||||
|
keyboardHide();
|
||||||
|
consoleClear();
|
||||||
|
|
||||||
|
if (newName[0] != '\0') {
|
||||||
|
if (rename(entry->name.c_str(), newName) == 0) {
|
||||||
|
getDirectoryContents (dirContents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete file/folder
|
// Delete file/folder
|
||||||
if ((pressed & KEY_X) && (strcmp (entry->name.c_str(), "..") != 0) && (strncmp (path, "nitro:/", 7) != 0)) {
|
if ((pressed & KEY_X) && (strcmp (entry->name.c_str(), "..") != 0) && (strncmp (path, "nitro:/", 7) != 0)) {
|
||||||
printf ("\x1b[0;27H");
|
printf ("\x1b[0;27H");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user