Fix Clang build errors and file traversal bug - #2
Open
rreha wants to merge 2 commits into
Open
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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++11flag that could override the project'sCMAKE_CXX_STANDARD 17setting, which could potentially break compilation forstd::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
getFileListNoPfswas usingi.pop()to skip folders like "sce_pfs", "sce_sys" and "sce_sys/package". However, becausepop()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()withi.disable_recursion_pending(). This restores the intended behavior (acting like Boost's oldno_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