Normalize firmware DB paths to POSIX format for cross-platform compatibility#92
Merged
Merged
Conversation
…ompatibility Use .as_posix() instead of str() when storing and comparing relative firmware paths in the database. This prevents path separator mismatches (backslash vs forward slash) when the same firmware folder is accessed from both Windows and Linux/WSL2. Fixes: Windows/Linux conflicts in mpflash database Agent-Logs-Url: https://github.com/Josverl/mpflash/sessions/b370abd5-407c-4f64-9aa2-03ffefb02d91 Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Windows/Linux conflicts in mpflash database
Normalize firmware DB paths to POSIX format for cross-platform compatibility
May 19, 2026
Josverl
approved these changes
May 20, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #92 +/- ##
==========================================
+ Coverage 75.55% 75.58% +0.03%
==========================================
Files 54 54
Lines 3031 3031
Branches 488 488
==========================================
+ Hits 2290 2291 +1
Misses 621 621
+ Partials 120 119 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
When the same firmware folder is accessed from both Windows and Linux/WSL2,
Path.relative_to()produces OS-native separators (\vs/). This causesclean_downloaded_firmwares()to fail matching DB records against disk files, incorrectly deleting valid records.Changes
mpflash/download/from_web.py: Use.as_posix()instead ofstr()when storing the relative path after downloadmpflash/downloaded.py: Use.as_posix()when building the on-disk file set for comparison with DB recordsBoth
db/loader.pyandcustom/naming.pyalready used.as_posix()— these two call sites were the only ones missing normalization.Tests
Added two tests validating that POSIX paths are used consistently for DB storage and disk-vs-DB comparison.