1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-26 13:52:06 +00:00

Add path as arg to readfolder();

This commit is contained in:
Such Meme, Many Skill 2019-08-15 00:42:41 +02:00
parent 785303fc15
commit 4d56912384
3 changed files with 15 additions and 13 deletions

View file

@ -28,7 +28,9 @@ void meme_main(){
char *itemsinfolder[250]; char *itemsinfolder[250];
unsigned int muhbits[250]; unsigned int muhbits[250];
int folderamount = 0; int folderamount = 0;
folderamount = readfolder(itemsinfolder, muhbits); char path[100] = "sd:/";
folderamount = readfolder(itemsinfolder, muhbits, path);
int i = 0; int i = 0;
gfx_printf("%d", folderamount); gfx_printf("%d", folderamount);

View file

@ -30,22 +30,22 @@ void utils_waitforpower(){
power_off(); power_off();
} }
int readfolder(char *items[], unsigned int *muhbits){ int readfolder(char *items[], unsigned int *muhbits, const char path[]){
DIR dir; DIR dir;
FILINFO fno; FILINFO fno;
char path[100] = "sd:/"; int i = 0;
if (f_opendir(&dir, path)) { if (f_opendir(&dir, path)) {
gfx_printf("\nFailed to open %s", path); gfx_printf("\nFailed to open %s", path);
} }
else{
int i = 0; while (!f_readdir(&dir, &fno) && fno.fname[0]){
while (!f_readdir(&dir, &fno) && fno.fname[0]){ size_t size = strlen(fno.fname) + 1;
size_t size = strlen(fno.fname) + 1; items[i] = (char*) malloc (size);
items[i] = (char*) malloc (size); strlcpy(items[i], fno.fname, size);
strlcpy(items[i], fno.fname, size); if (fno.fattrib & AM_DIR) muhbits[i] |= (OPTION1);
if (fno.fattrib & AM_DIR) muhbits[i] |= (OPTION1); i++;
i++; }
} }
return i; return i;
} }

View file

@ -2,4 +2,4 @@
void utils_gfx_init(); void utils_gfx_init();
void utils_waitforpower(); void utils_waitforpower();
int readfolder(char *items[], unsigned int *muhbits); int readfolder(char *items[], unsigned int *muhbits, const char path[]);