Skip to content

Commit bec9c38

Browse files
committed
[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.
1 parent 451c1a7 commit bec9c38

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/xenia/base/filesystem_posix.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ std::vector<FileInfo> ListFiles(const std::filesystem::path& path) {
219219
while (auto ent = readdir(dir)) {
220220
FileInfo info;
221221

222+
if (ent->d_name[0] == '.') {
223+
continue;
224+
}
225+
222226
info.name = ent->d_name;
223227
struct stat st;
224228
stat((path / info.name).c_str(), &st);

0 commit comments

Comments
 (0)