1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 20:06:43 +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

@ -24,11 +24,13 @@ void meme_main(){
sdmmc_storage_set_mmc_partition(&storage, 1); sdmmc_storage_set_mmc_partition(&storage, 1);
//f_rename("sd:/yeet.txt", "sd:/yote.txt"); //f_rename("sd:/yeet.txt", "sd:/yote.txt");
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[]);