Unify behavior of source code search#332
Merged
disinvite merged 6 commits intoisledecomp:masterfrom Mar 8, 2026
Merged
Conversation
walk_source_dir
jonschz
approved these changes
Mar 8, 2026
Collaborator
jonschz
left a comment
There was a problem hiding this comment.
Looks good, the test coverage is nice. I didn't check for regressions in great detail, though
Collaborator
Author
The only new thing should be the ordering of paths, but I don't expect a change in behavior unless both are true:
I checked with a few projects on Windows and didn't see a diff. No diff for |
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.
This started with fixing a problem observed in #331 and evolved from there.
Fixing compatibility issues in
walk_source_dirwalk_source_diriterates the root source code directory for a decomp project. #279 changed this to usePath.walk()instead ofos.walk(). The problem is thatPath.walk()is only available on Python 3.12 and higher, but we still support a few versions earlier than that. This was missed because no unit tests targetedwalk_source_dir. We didn't hear anything from users so hopefully the explanation is that no one is usingreccmpwith older Python versions.This restores the older
os.walk()implementation so we can keep compatibility with Python 3.10 and 3.11. We now have unit tests to verify the behavior ofwalk_source_dir.Returning source code paths in a consistent order
decomplintalready supported multiple source code search paths at the command line, and we will add this option in #331. In the mainreccmpscript, there is the potential for data to be overwritten if we read metadata for the same address in multiple files. Therefore, we need to ensure:The second point is an issue because
pathlib.PosixPathis sorted in case-sensitive order, butpathlib.WindowsPathis not. The paths are now always sorted in case-insensitive order so the output will be the same across platforms.To bring this all together, we now have a
source_code_searchfunction. Tests are included.