fixed: bare tag name folders are always empty
This commit is contained in:
parent
0f75041c09
commit
2492aefb87
1 changed files with 20 additions and 19 deletions
|
|
@ -781,26 +781,27 @@ static Array* getEntries(char* path){
|
||||||
char collated_path[256];
|
char collated_path[256];
|
||||||
strcpy(collated_path, path);
|
strcpy(collated_path, path);
|
||||||
char* tmp = strrchr(collated_path, '(');
|
char* tmp = strrchr(collated_path, '(');
|
||||||
if (tmp) {
|
// 1 because we want to keep the opening parenthesis to avoid collating "Game Boy Color" and "Game Boy Advance" into "Game Boy"
|
||||||
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"
|
// 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);
|
DIR *dh = opendir(ROMS_PATH);
|
||||||
if (dh!=NULL) {
|
if (dh!=NULL) {
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
char full_path[256];
|
char full_path[256];
|
||||||
sprintf(full_path, "%s/", ROMS_PATH);
|
sprintf(full_path, "%s/", ROMS_PATH);
|
||||||
tmp = full_path + strlen(full_path);
|
tmp = full_path + strlen(full_path);
|
||||||
// while loop so we can collate paths, see above
|
LOG_info("%s\n", full_path);
|
||||||
while((dp = readdir(dh)) != NULL) {
|
// while loop so we can collate paths, see above
|
||||||
if (hide(dp->d_name)) continue;
|
while((dp = readdir(dh)) != NULL) {
|
||||||
if (dp->d_type!=DT_DIR) continue;
|
if (hide(dp->d_name)) continue;
|
||||||
strcpy(tmp, dp->d_name);
|
if (dp->d_type!=DT_DIR) continue;
|
||||||
|
strcpy(tmp, dp->d_name);
|
||||||
|
|
||||||
if (!prefixMatch(collated_path, full_path)) continue;
|
if (!prefixMatch(collated_path, full_path)) continue;
|
||||||
addEntries(entries, full_path);
|
addEntries(entries, full_path);
|
||||||
}
|
|
||||||
closedir(dh);
|
|
||||||
}
|
}
|
||||||
|
closedir(dh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else addEntries(entries, path); // just a subfolder
|
else addEntries(entries, path); // just a subfolder
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue