fs: fix stdio dir count not filtering types. game/bfsar: fix dir listing loop exiting early due to post increment in the loop.
This commit is contained in:
@@ -688,6 +688,20 @@ Result Dir::GetEntryCount(s64* out) {
|
|||||||
if (!std::strcmp(d->d_name, ".") || !std::strcmp(d->d_name, "..")) {
|
if (!std::strcmp(d->d_name, ".") || !std::strcmp(d->d_name, "..")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->d_type == DT_DIR) {
|
||||||
|
if (!(m_mode & FsDirOpenMode_ReadDirs)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (d->d_type == DT_REG) {
|
||||||
|
if (!(m_mode & FsDirOpenMode_ReadFiles)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log_write("[FS] WARNING: unknown type when counting dir: %u\n", d->d_type);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
(*out)++;
|
(*out)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ int Device::devoptab_dirnext(void* fd, char *filename, struct stat *filestat) {
|
|||||||
filestat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
|
filestat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
dir->index++;
|
dir->index++;
|
||||||
break;
|
break;
|
||||||
} while (dir->index++);
|
} while (++dir->index);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ int Device::devoptab_dirnext(void* fd, char *filename, struct stat *filestat) {
|
|||||||
std::snprintf(filename, NAME_MAX, "%s", content.nsp->path.s);
|
std::snprintf(filename, NAME_MAX, "%s", content.nsp->path.s);
|
||||||
dir->index++;
|
dir->index++;
|
||||||
break;
|
break;
|
||||||
} while (dir->index++);
|
} while (++dir->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user