Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert windows path delimiter to posix (#2149) #2150

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jjonethal
Copy link

@jjonethal jjonethal commented Dec 27, 2024

Fixes #2149
When generating lwip file system data convert windows directory separators by posix separators.
This is an issue when native directory during resource generation separator is "\" as on windows. Running toolchain from mingw64 python3 would also preserve "\" in resource name which would cause mismatch on resource lookup.
Fix should be portable with python 3.4 and up.

@peterharperuk peterharperuk self-requested a review December 27, 2024 21:27
@lurch
Copy link
Contributor

lurch commented Dec 27, 2024

ping @ndabas , in light of the work he did in #1841

Comment on lines +27 to +28
data = f"/{file.relative_to(input_dir).as_posix()}\x00"
comment = f"\"/{file.relative_to(input_dir).as_posix()}\" ({len(data)} chars)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth doing a small refactoring here, so that the file.relative_to(input_dir).as_posix() is done just once (and assigned to a new variable) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this minor refactor would make it a bit cleaner for sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps separate refactoring from delimiter handling to make changes more consistent, since there are some format strings that could be refactored ? Perhaps add a new issue for refactoring ?

Copy link
Contributor

@ndabas ndabas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall fix looks good to me.

Comment on lines +27 to +28
data = f"/{file.relative_to(input_dir).as_posix()}\x00"
comment = f"\"/{file.relative_to(input_dir).as_posix()}\" ({len(data)} chars)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this minor refactor would make it a bit cleaner for sure.

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.

3 participants