[Base] Fix infinite recursion on Posix filesystem

When listing all files in a folder, ignore hidden files (which start
with a dot). This prevents parsing ".." as a folder to enter, thus going
back one level and entering an infinite loop of folders to parse.
This commit is contained in:
Alexandre Messier 2022-05-12 21:42:36 -04:00
parent 451c1a7d75
commit bec9c387be
1 changed files with 4 additions and 0 deletions

View File

@ -219,6 +219,10 @@ std::vector<FileInfo> ListFiles(const std::filesystem::path& path) {
while (auto ent = readdir(dir)) {
FileInfo info;
if (ent->d_name[0] == '.') {
continue;
}
info.name = ent->d_name;
struct stat st;
stat((path / info.name).c_str(), &st);