Refactor File Path Handling: Replace os.path with pathlib.Path#2812
Merged
kerizane merged 1 commit intoTuxemon:developmentfrom May 29, 2025
Merged
Refactor File Path Handling: Replace os.path with pathlib.Path#2812kerizane merged 1 commit intoTuxemon:developmentfrom
os.path with pathlib.Path#2812kerizane merged 1 commit intoTuxemon:developmentfrom
Conversation
e087195 to
7774e7b
Compare
95ee43e to
42f5e5c
Compare
kerizane
approved these changes
May 29, 2025
This was referenced Jun 11, 2025
la-xirsoi
added a commit
that referenced
this pull request
Jun 20, 2025
Enhancing Path Consistency in PR #2812
Rhys-T
added a commit
to Rhys-T/nur-packages
that referenced
this pull request
Jul 3, 2025
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.
PR refactors multiple files by replacing
os.pathfunctions such asos.path.join,os.path.basename, andos.path.exists, etc. withpathlib.Path.Key changes:
os.path.join()withPath() / "filename".nameinstead ofos.path.basename()for cleaner path extractionos.path.exists()toPath.exists()for improved clarityos.remove()calls toPath.unlink()for better deletion handlingPath.iterdir()instead ofos.listdir()this is going to fix #1229 (probably), because:
LIBDIR.parent / "mods"correctly moves up one level fromlib/tuxemonto the parent directory (exe.win-amd64-3.12), then joins"mods"to itmodsis a sibling oflib, not mistakenly placed inside itpathlibensures compatibility across different OS without requiringos.path.joinor normalization