Skip to content

Fix Clang build errors and file traversal bug - #2

Open
rreha wants to merge 2 commits into
olebeck:masterfrom
rreha:clang-fs-traversal-fix
Open

Fix Clang build errors and file traversal bug#2
rreha wants to merge 2 commits into
olebeck:masterfrom
rreha:clang-fs-traversal-fix

Conversation

@rreha

@rreha rreha commented Jul 27, 2026

Copy link
Copy Markdown

I ran into two issues preventing psvpfsparser from compiling and running properly while trying to use it on macOS (arm64/silicon). This PR fixes both.

Fix build on Clang and C++ version conflict

The build failed on macOS with an "Unknown compiler" error because CMakeLists.txt only checked for MSVC and GCC. I added Clang to the check.

I also removed a hardcoded -std=c++11 flag that could override the project's CMAKE_CXX_STANDARD 17 setting, which could potentially break compilation for std::filesystem.

Fix incomplete directory traversal causing "file does not exist" errors

After getting it to compile, the tool was failing on my game dumps with the "File ./app/PCSXXXXXX/sce_sys/param.sfo does not exist" error.

The getFileListNoPfs was using i.pop() to skip folders like "sce_pfs", "sce_sys" and "sce_sys/package". However, because pop() aborts the parent directory's iteration and "sce_pfs" is located at the root of the dump, it caused the iterator to completely abort scanning the game folder. Any directory/file processed after "sce_pfs" (such as "sce_sys") was ignored entirely, resulting in "File ... does not exist" errors for valid files.

I replaced i.pop() with i.disable_recursion_pending(). This restores the intended behavior (acting like Boost's old no_push()), skipping the target directory but continuing to read the rest of the files in the parent folder safely.

See:
std::filesystem::recursive_directory_iterator:: pop - cppreference.com
std::filesystem::recursive_directory_iterator:: disable_recursion_pending - cppreference.com
The equivalent of boost::filesystem::recursive_directory_iterator's no_push() in std::filesystem::recursive_directory_iterator

rreha added 2 commits July 27, 2026 18:57
- Using Clang triggered the "Unknown compiler" error. Added Clang to the GNU check block.

- Removed the hardcoded "-std=c++11" flag from CMAKE_CXX_FLAGS. The project already specifies "CMAKE_CXX_STANDARD 17" globally. Forcing C++11 can cause compilation to fail on modern compilers when resolving C++17 features like "std::filesystem".
- Replaced "i.pop()" with "i.disable_recursion_pending()" to correctly skip the subdirectories while safely continuing to scan the rest of the parent folder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant