i have no brain and i must rename
This commit is contained in:
@@ -94,7 +94,9 @@ extern menu_entry fs_menu_file[];
|
|||||||
enum fs_menu_folder_return {
|
enum fs_menu_folder_return {
|
||||||
DIR_EXITFOLDER = 2,
|
DIR_EXITFOLDER = 2,
|
||||||
DIR_COPYFOLDER,
|
DIR_COPYFOLDER,
|
||||||
DIR_DELETEFOLDER
|
DIR_DELETEFOLDER,
|
||||||
|
DIR_RENAME,
|
||||||
|
DIR_CREATE
|
||||||
};
|
};
|
||||||
|
|
||||||
extern menu_entry fs_menu_folder[];
|
extern menu_entry fs_menu_folder[];
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ menu_entry fs_menu_folder[] = {
|
|||||||
{"\nBack", COLOR_WHITE, ISMENU},
|
{"\nBack", COLOR_WHITE, ISMENU},
|
||||||
{"Return to main menu\n", COLOR_BLUE, ISMENU},
|
{"Return to main menu\n", COLOR_BLUE, ISMENU},
|
||||||
{"Copy to clipboard", COLOR_VIOLET, 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[] = {
|
menu_entry fs_menu_startdir[] = {
|
||||||
|
|||||||
@@ -171,9 +171,17 @@ int filemenu(menu_entry file){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
utils_copystring(fsutil_getnextloc(currentpath, file.name), &curPath);
|
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(curPath);
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
|
if (temp){
|
||||||
|
gfx_errDisplay("fileMenu", temp, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fsreader_readfolder(currentpath);
|
fsreader_readfolder(currentpath);
|
||||||
break;
|
break;
|
||||||
case FILE_PAYLOAD:
|
case FILE_PAYLOAD:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "fsactions.h"
|
#include "fsactions.h"
|
||||||
#include "fsutils.h"
|
#include "fsutils.h"
|
||||||
#include "../../utils/sprintf.h"
|
#include "../../utils/sprintf.h"
|
||||||
|
#include "../utils/utils.h"
|
||||||
|
|
||||||
extern char *currentpath;
|
extern char *currentpath;
|
||||||
extern char *clipboard;
|
extern char *clipboard;
|
||||||
@@ -39,6 +40,7 @@ void copyfolder(char *in, char *out){
|
|||||||
|
|
||||||
int foldermenu(){
|
int foldermenu(){
|
||||||
int res;
|
int res;
|
||||||
|
char *name;
|
||||||
FILINFO attribs;
|
FILINFO attribs;
|
||||||
|
|
||||||
if (fs_menu_folder[0].name != NULL)
|
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[3].property, ISHIDE, (*(currentpath + res - 1) == '/'));
|
||||||
SETBIT(fs_menu_folder[4].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))
|
if (f_stat(currentpath, &attribs))
|
||||||
SETBIT(fs_menu_folder[0].property, ISHIDE, 1);
|
SETBIT(fs_menu_folder[0].property, ISHIDE, 1);
|
||||||
@@ -62,7 +65,7 @@ int foldermenu(){
|
|||||||
(attribs.fattrib & AM_ARC) ? 'A' : '-');
|
(attribs.fattrib & AM_ARC) ? 'A' : '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
res = menu_make(fs_menu_folder, 5, currentpath);
|
res = menu_make(fs_menu_folder, 7, currentpath);
|
||||||
|
|
||||||
switch (res){
|
switch (res){
|
||||||
case DIR_EXITFOLDER:
|
case DIR_EXITFOLDER:
|
||||||
@@ -73,8 +76,7 @@ int foldermenu(){
|
|||||||
break;
|
break;
|
||||||
case DIR_DELETEFOLDER:
|
case DIR_DELETEFOLDER:
|
||||||
gfx_clearscreen();
|
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_defaultWaitMenu("Do you want to delete this folder?\nThe entire folder, with all subcontents will be deleted!!!", 4)){
|
||||||
if (gfx_makewaitmenu("Press power to contine...", 3)){
|
|
||||||
gfx_clearscreen();
|
gfx_clearscreen();
|
||||||
gfx_printf("\nDeleting folder, please wait...\n");
|
gfx_printf("\nDeleting folder, please wait...\n");
|
||||||
|
|
||||||
@@ -84,6 +86,49 @@ int foldermenu(){
|
|||||||
fsreader_readfolder(currentpath);
|
fsreader_readfolder(currentpath);
|
||||||
}
|
}
|
||||||
break;
|
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;
|
return 0;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void fileexplorer(const char *startpath, int type){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FILEMENU_CURFOLDER:
|
case FILEMENU_CURFOLDER:
|
||||||
if (foldermenu())
|
if (foldermenu() < 0)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
|
|||||||
@@ -98,11 +98,17 @@ char *utils_InputText(char *start, int maxLen){
|
|||||||
if (input->buttons & (KEY_A | KEY_B))
|
if (input->buttons & (KEY_A | KEY_B))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (input->buttons & (KEY_LDOWN | KEY_RDOWN) && buff[currentPos] < 126)
|
if (input->buttons & (KEY_LDOWN | KEY_RDOWN) && buff[currentPos] < 126){
|
||||||
buff[currentPos]++;
|
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)
|
if (input->buttons & (KEY_LUP | KEY_RUP) && buff[currentPos] > 32){
|
||||||
buff[currentPos]--;
|
temp = --buff[currentPos];
|
||||||
|
while (temp == '\\' || temp == '/' || temp == ':' || temp == '*' || temp == '?' || temp == '"' || temp == '<' || temp == '>' || temp == '|')
|
||||||
|
temp = --buff[currentPos];
|
||||||
|
}
|
||||||
|
|
||||||
if (input->Lleft && currentPos > 0)
|
if (input->Lleft && currentPos > 0)
|
||||||
currentPos--;
|
currentPos--;
|
||||||
|
|||||||
Reference in New Issue
Block a user