mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-12-26 11:26:05 +00:00
i have no brain and i must rename
This commit is contained in:
parent
b273b1e5ab
commit
f9cf371cf9
6 changed files with 74 additions and 11 deletions
|
@ -94,7 +94,9 @@ extern menu_entry fs_menu_file[];
|
|||
enum fs_menu_folder_return {
|
||||
DIR_EXITFOLDER = 2,
|
||||
DIR_COPYFOLDER,
|
||||
DIR_DELETEFOLDER
|
||||
DIR_DELETEFOLDER,
|
||||
DIR_RENAME,
|
||||
DIR_CREATE
|
||||
};
|
||||
|
||||
extern menu_entry fs_menu_folder[];
|
||||
|
|
|
@ -61,7 +61,9 @@ menu_entry fs_menu_folder[] = {
|
|||
{"\nBack", COLOR_WHITE, ISMENU},
|
||||
{"Return to main menu\n", COLOR_BLUE, ISMENU},
|
||||
{"Copy to clipboard", COLOR_VIOLET, ISMENU},
|
||||
{"Delete folder", COLOR_RED, ISMENU}
|
||||
{"Delete folder", COLOR_RED, ISMENU},
|
||||
{"Rename folder", COLOR_BLUE, ISMENU},
|
||||
{"Create folder", COLOR_BLUE, ISMENU}
|
||||
};
|
||||
|
||||
menu_entry fs_menu_startdir[] = {
|
||||
|
|
|
@ -171,9 +171,17 @@ int filemenu(menu_entry file){
|
|||
break;
|
||||
|
||||
utils_copystring(fsutil_getnextloc(currentpath, file.name), &curPath);
|
||||
f_rename(curPath, fsutil_getnextloc(currentpath, name));
|
||||
|
||||
temp = f_rename(curPath, fsutil_getnextloc(currentpath, name));
|
||||
|
||||
free(curPath);
|
||||
free(name);
|
||||
|
||||
if (temp){
|
||||
gfx_errDisplay("fileMenu", temp, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
fsreader_readfolder(currentpath);
|
||||
break;
|
||||
case FILE_PAYLOAD:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "fsactions.h"
|
||||
#include "fsutils.h"
|
||||
#include "../../utils/sprintf.h"
|
||||
#include "../utils/utils.h"
|
||||
|
||||
extern char *currentpath;
|
||||
extern char *clipboard;
|
||||
|
@ -39,6 +40,7 @@ void copyfolder(char *in, char *out){
|
|||
|
||||
int foldermenu(){
|
||||
int res;
|
||||
char *name;
|
||||
FILINFO attribs;
|
||||
|
||||
if (fs_menu_folder[0].name != NULL)
|
||||
|
@ -50,6 +52,7 @@ int foldermenu(){
|
|||
|
||||
SETBIT(fs_menu_folder[3].property, ISHIDE, (*(currentpath + res - 1) == '/'));
|
||||
SETBIT(fs_menu_folder[4].property, ISHIDE, (*(currentpath + res - 1) == '/'));
|
||||
SETBIT(fs_menu_folder[5].property, ISHIDE, (*(currentpath + res - 1) == '/'));
|
||||
|
||||
if (f_stat(currentpath, &attribs))
|
||||
SETBIT(fs_menu_folder[0].property, ISHIDE, 1);
|
||||
|
@ -62,7 +65,7 @@ int foldermenu(){
|
|||
(attribs.fattrib & AM_ARC) ? 'A' : '-');
|
||||
}
|
||||
|
||||
res = menu_make(fs_menu_folder, 5, currentpath);
|
||||
res = menu_make(fs_menu_folder, 7, currentpath);
|
||||
|
||||
switch (res){
|
||||
case DIR_EXITFOLDER:
|
||||
|
@ -73,8 +76,7 @@ int foldermenu(){
|
|||
break;
|
||||
case DIR_DELETEFOLDER:
|
||||
gfx_clearscreen();
|
||||
gfx_printf("Do you want to delete this folder?\nThe entire folder, with all subcontents\n will be deleted!!!\n\nPress vol+/- to cancel\n");
|
||||
if (gfx_makewaitmenu("Press power to contine...", 3)){
|
||||
if (gfx_defaultWaitMenu("Do you want to delete this folder?\nThe entire folder, with all subcontents will be deleted!!!", 4)){
|
||||
gfx_clearscreen();
|
||||
gfx_printf("\nDeleting folder, please wait...\n");
|
||||
|
||||
|
@ -84,6 +86,49 @@ int foldermenu(){
|
|||
fsreader_readfolder(currentpath);
|
||||
}
|
||||
break;
|
||||
case DIR_RENAME:;
|
||||
char *prevLoc, *dirName;
|
||||
|
||||
dirName = strrchr(currentpath, '/') + 1;
|
||||
|
||||
gfx_clearscreen();
|
||||
gfx_printf("Renaming %s...\n\n", dirName);
|
||||
name = utils_InputText(dirName, 32);
|
||||
if (name == NULL)
|
||||
break;
|
||||
|
||||
utils_copystring(fsutil_getprevloc(currentpath), &prevLoc);
|
||||
res = f_rename(currentpath, fsutil_getnextloc(prevLoc, name));
|
||||
|
||||
free(prevLoc);
|
||||
free(name);
|
||||
|
||||
if (res){
|
||||
gfx_errDisplay("folderMenu", res, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
fsreader_writecurpath(fsutil_getprevloc(currentpath));
|
||||
fsreader_readfolder(currentpath);
|
||||
|
||||
break;
|
||||
case DIR_CREATE:;
|
||||
gfx_clearscreen();
|
||||
gfx_printf("Give a name for your new folder\n\n");
|
||||
name = utils_InputText("New Folder", 32);
|
||||
if (name == NULL)
|
||||
break;
|
||||
|
||||
res = f_mkdir(fsutil_getnextloc(currentpath, name));
|
||||
free(name);
|
||||
|
||||
if (res){
|
||||
gfx_errDisplay("folderMenu", res, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
fsreader_readfolder(currentpath);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -55,7 +55,7 @@ void fileexplorer(const char *startpath, int type){
|
|||
break;
|
||||
|
||||
case FILEMENU_CURFOLDER:
|
||||
if (foldermenu())
|
||||
if (foldermenu() < 0)
|
||||
return;
|
||||
break;
|
||||
case -1:
|
||||
|
|
|
@ -98,11 +98,17 @@ char *utils_InputText(char *start, int maxLen){
|
|||
if (input->buttons & (KEY_A | KEY_B))
|
||||
break;
|
||||
|
||||
if (input->buttons & (KEY_LDOWN | KEY_RDOWN) && buff[currentPos] < 126)
|
||||
buff[currentPos]++;
|
||||
if (input->buttons & (KEY_LDOWN | KEY_RDOWN) && buff[currentPos] < 126){
|
||||
temp = ++buff[currentPos];
|
||||
while (temp == '\\' || temp == '/' || temp == ':' || temp == '*' || temp == '?' || temp == '"' || temp == '<' || temp == '>' || temp == '|')
|
||||
temp = ++buff[currentPos];
|
||||
}
|
||||
|
||||
if (input->buttons & (KEY_LUP | KEY_RUP) && buff[currentPos] > 32)
|
||||
buff[currentPos]--;
|
||||
if (input->buttons & (KEY_LUP | KEY_RUP) && buff[currentPos] > 32){
|
||||
temp = --buff[currentPos];
|
||||
while (temp == '\\' || temp == '/' || temp == ':' || temp == '*' || temp == '?' || temp == '"' || temp == '<' || temp == '>' || temp == '|')
|
||||
temp = --buff[currentPos];
|
||||
}
|
||||
|
||||
if (input->Lleft && currentPos > 0)
|
||||
currentPos--;
|
||||
|
|
Loading…
Reference in a new issue