Add renaming option
This commit is contained in:
@@ -36,7 +36,7 @@ int delfile(const char *path, const char *filename){
|
||||
|
||||
void viewbytes(char *path){
|
||||
FIL in;
|
||||
u8 print[1024];
|
||||
u8 *print;
|
||||
u32 size;
|
||||
QWORD offset = 0;
|
||||
int res;
|
||||
@@ -45,6 +45,7 @@ void viewbytes(char *path){
|
||||
while (input->buttons & (KEY_POW | KEY_B));
|
||||
|
||||
gfx_clearscreen();
|
||||
print = malloc (1024);
|
||||
|
||||
if ((res = f_open(&in, path, FA_READ | FA_OPEN_EXISTING))){
|
||||
gfx_errDisplay("viewbytes", res, 1);
|
||||
@@ -54,7 +55,7 @@ void viewbytes(char *path){
|
||||
while (1){
|
||||
f_lseek(&in, offset * 16);
|
||||
|
||||
if ((res = f_read(&in, &print, 1024 * sizeof(u8), &size))){
|
||||
if ((res = f_read(&in, print, 1024 * sizeof(u8), &size))){
|
||||
gfx_errDisplay("viewbytes", res, 2);
|
||||
return;
|
||||
}
|
||||
@@ -75,6 +76,7 @@ void viewbytes(char *path){
|
||||
break;
|
||||
}
|
||||
f_close(&in);
|
||||
free(print);
|
||||
}
|
||||
|
||||
void copyfile(const char *src_in, const char *outfolder){
|
||||
@@ -145,12 +147,11 @@ int filemenu(menu_entry file){
|
||||
(attribs.fattrib & AM_ARC) ? 'A' : '-');
|
||||
}
|
||||
|
||||
SETBIT(fs_menu_file[7].property, ISHIDE, !(strstr(file.name, ".bin") != NULL && file.property & ISKB) && strstr(file.name, ".rom") == NULL);
|
||||
SETBIT(fs_menu_file[8].property, ISHIDE, strstr(file.name, ".te") == NULL);
|
||||
SETBIT(fs_menu_file[10].property, ISHIDE, strstr(file.name, ".bis") == NULL);
|
||||
|
||||
temp = menu_make(fs_menu_file, 11, "-- File Menu --");
|
||||
SETBIT(fs_menu_file[8].property, ISHIDE, !(strstr(file.name, ".bin") != NULL && file.property & ISKB) && strstr(file.name, ".rom") == NULL);
|
||||
SETBIT(fs_menu_file[9].property, ISHIDE, strstr(file.name, ".te") == NULL);
|
||||
SETBIT(fs_menu_file[11].property, ISHIDE, strstr(file.name, ".bis") == NULL);
|
||||
|
||||
temp = menu_make(fs_menu_file, 12, "-- File Menu --");
|
||||
switch (temp){
|
||||
case FILE_COPY:
|
||||
fsreader_writeclipboard(fsutil_getnextloc(currentpath, file.name), OPERATIONCOPY);
|
||||
@@ -161,6 +162,20 @@ int filemenu(menu_entry file){
|
||||
case FILE_DELETE:
|
||||
delfile(fsutil_getnextloc(currentpath, file.name), file.name);
|
||||
break;
|
||||
case FILE_RENAME:;
|
||||
char *name, *curPath;
|
||||
gfx_clearscreen();
|
||||
gfx_printf("Renaming %s...\n\n", file.name);
|
||||
name = utils_InputText(file.name, 32);
|
||||
if (name == NULL)
|
||||
break;
|
||||
|
||||
utils_copystring(fsutil_getnextloc(currentpath, file.name), &curPath);
|
||||
f_rename(curPath, fsutil_getnextloc(currentpath, name));
|
||||
free(curPath);
|
||||
free(name);
|
||||
fsreader_readfolder(currentpath);
|
||||
break;
|
||||
case FILE_PAYLOAD:
|
||||
launch_payload(fsutil_getnextloc(currentpath, file.name));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user