2020-03-18 22:58:32 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include "fsmenu.h"
|
|
|
|
#include "fsreader.h"
|
|
|
|
#include "../gfx/menu.h"
|
|
|
|
#include "../gfx/gfxutils.h"
|
|
|
|
#include "fsutils.h"
|
|
|
|
#include "../common/common.h"
|
|
|
|
#include "../../libs/fatfs/ff.h"
|
|
|
|
#include "entrymenu.h"
|
2020-05-04 12:55:26 +01:00
|
|
|
#include "../utils/menuUtils.h"
|
2020-03-18 22:58:32 +00:00
|
|
|
|
|
|
|
extern char *currentpath;
|
|
|
|
extern char *clipboard;
|
|
|
|
extern u8 clipboardhelper;
|
|
|
|
int lastentry = 0;
|
|
|
|
|
|
|
|
void fileexplorer(const char *startpath, int type){
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (lastentry > 0 && lastentry == type)
|
|
|
|
clipboardhelper = 0;
|
|
|
|
|
2020-04-05 16:07:11 +01:00
|
|
|
if (clipboardhelper & OPERATIONMOVE)
|
|
|
|
clipboardhelper = 0;
|
|
|
|
|
2020-03-18 22:58:32 +00:00
|
|
|
lastentry = type;
|
|
|
|
|
|
|
|
fsreader_writecurpath(startpath);
|
|
|
|
fsreader_readfolder(currentpath);
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (strcmp(rootpath, "emmc:/"))
|
|
|
|
explfilemenu[6].property = 1;
|
|
|
|
else
|
|
|
|
explfilemenu[6].property = -1;
|
|
|
|
*/
|
|
|
|
|
|
|
|
while (1){
|
2020-05-04 19:48:23 +01:00
|
|
|
res = menu_make(fsreader_files, mu_countObjects(fsreader_files, 0, 0), currentpath);
|
2020-03-18 22:58:32 +00:00
|
|
|
switch (res){
|
|
|
|
case FILEMENU_RETURN:
|
|
|
|
if (!strcmp(startpath, currentpath))
|
|
|
|
return;
|
|
|
|
else {
|
|
|
|
fsreader_writecurpath(fsutil_getprevloc(currentpath));
|
|
|
|
fsreader_readfolder(currentpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case FILEMENU_CLIPBOARD:
|
|
|
|
if (clipboardhelper & ISDIR)
|
|
|
|
copyfolder(clipboard, currentpath);
|
|
|
|
else
|
|
|
|
copyfile(clipboard, currentpath);
|
2020-04-04 23:33:12 +01:00
|
|
|
clipboardhelper = 0;
|
2020-03-18 22:58:32 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FILEMENU_CURFOLDER:
|
2020-05-02 16:31:00 +01:00
|
|
|
if (foldermenu() < 0)
|
2020-03-18 22:58:32 +00:00
|
|
|
return;
|
|
|
|
break;
|
2020-03-22 21:56:36 +00:00
|
|
|
case -1:
|
|
|
|
return;
|
2020-03-18 22:58:32 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
if(fsreader_files[res].property & ISDIR){
|
|
|
|
fsreader_writecurpath(fsutil_getnextloc(currentpath, fsreader_files[res].name));
|
|
|
|
fsreader_readfolder(currentpath);
|
|
|
|
}
|
|
|
|
else
|
2020-03-22 21:56:36 +00:00
|
|
|
if(filemenu(fsreader_files[res]))
|
|
|
|
return;
|
2020-03-18 22:58:32 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
while (1){
|
|
|
|
res = makefilemenu(fileobjects, getfileobjamount(), currentpath);
|
|
|
|
if (res < 1){
|
|
|
|
switch (res){
|
|
|
|
case -2:
|
|
|
|
if (!strcmp(rootpath, currentpath))
|
|
|
|
breakfree = true;
|
|
|
|
else {
|
|
|
|
writecurpath(getprevloc(currentpath));
|
|
|
|
readfolder(currentpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1:
|
|
|
|
if (clipboardhelper & ISDIR)
|
|
|
|
copyfolder(clipboard, currentpath);
|
|
|
|
else
|
|
|
|
copyfile(clipboard, currentpath);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
tempint = foldermenu();
|
|
|
|
|
|
|
|
if (tempint == -1)
|
|
|
|
breakfree = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (fileobjects[res - 1].property & ISDIR){
|
|
|
|
writecurpath(getnextloc(currentpath, fileobjects[res - 1].name));
|
|
|
|
readfolder(currentpath);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
filemenu(fileobjects[res - 1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (breakfree)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|