fixed: bare tag name folders are always empty

This commit is contained in:
Shaun Inman 2023-03-21 20:51:53 -04:00
parent 0f75041c09
commit 2492aefb87

View file

@ -781,8 +781,9 @@ static Array* getEntries(char* path){
char collated_path[256];
strcpy(collated_path, path);
char* tmp = strrchr(collated_path, '(');
if (tmp) {
tmp[1] = '\0'; // 1 because we want to keep the opening parenthesis to avoid collating "Game Boy Color" and "Game Boy Advance" into "Game Boy"
// 1 because we want to keep the opening parenthesis to avoid collating "Game Boy Color" and "Game Boy Advance" into "Game Boy"
// but conditional so we can continue to support a bare tag name as a folder name
if (tmp) tmp[1] = '\0';
DIR *dh = opendir(ROMS_PATH);
if (dh!=NULL) {
@ -790,6 +791,7 @@ static Array* getEntries(char* path){
char full_path[256];
sprintf(full_path, "%s/", ROMS_PATH);
tmp = full_path + strlen(full_path);
LOG_info("%s\n", full_path);
// while loop so we can collate paths, see above
while((dp = readdir(dh)) != NULL) {
if (hide(dp->d_name)) continue;
@ -802,7 +804,6 @@ static Array* getEntries(char* path){
closedir(dh);
}
}
}
else addEntries(entries, path); // just a subfolder
EntryArray_sort(entries);