mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 11:56:42 +00:00
Add path as arg to readfolder();
This commit is contained in:
parent
785303fc15
commit
4d56912384
3 changed files with 15 additions and 13 deletions
|
@ -24,11 +24,13 @@ void meme_main(){
|
|||
sdmmc_storage_set_mmc_partition(&storage, 1);
|
||||
|
||||
//f_rename("sd:/yeet.txt", "sd:/yote.txt");
|
||||
|
||||
|
||||
char *itemsinfolder[250];
|
||||
unsigned int muhbits[250];
|
||||
int folderamount = 0;
|
||||
folderamount = readfolder(itemsinfolder, muhbits);
|
||||
char path[100] = "sd:/";
|
||||
|
||||
folderamount = readfolder(itemsinfolder, muhbits, path);
|
||||
|
||||
int i = 0;
|
||||
gfx_printf("%d", folderamount);
|
||||
|
|
|
@ -30,22 +30,22 @@ void utils_waitforpower(){
|
|||
power_off();
|
||||
}
|
||||
|
||||
int readfolder(char *items[], unsigned int *muhbits){
|
||||
int readfolder(char *items[], unsigned int *muhbits, const char path[]){
|
||||
DIR dir;
|
||||
FILINFO fno;
|
||||
char path[100] = "sd:/";
|
||||
int i = 0;
|
||||
|
||||
if (f_opendir(&dir, path)) {
|
||||
gfx_printf("\nFailed to open %s", path);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (!f_readdir(&dir, &fno) && fno.fname[0]){
|
||||
size_t size = strlen(fno.fname) + 1;
|
||||
items[i] = (char*) malloc (size);
|
||||
strlcpy(items[i], fno.fname, size);
|
||||
if (fno.fattrib & AM_DIR) muhbits[i] |= (OPTION1);
|
||||
i++;
|
||||
else{
|
||||
while (!f_readdir(&dir, &fno) && fno.fname[0]){
|
||||
size_t size = strlen(fno.fname) + 1;
|
||||
items[i] = (char*) malloc (size);
|
||||
strlcpy(items[i], fno.fname, size);
|
||||
if (fno.fattrib & AM_DIR) muhbits[i] |= (OPTION1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
void utils_gfx_init();
|
||||
void utils_waitforpower();
|
||||
int readfolder(char *items[], unsigned int *muhbits);
|
||||
int readfolder(char *items[], unsigned int *muhbits, const char path[]);
|
Loading…
Reference in a new issue