-
Notifications
You must be signed in to change notification settings - Fork 27
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
Adapt paths for different development environments #336
Open
maple135790
wants to merge
5
commits into
dart-lang:main
Choose a base branch
from
maple135790:windows-path
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+25
−21
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
69ca4b7
Fix path to adapt cross-platform development
maple135790 40a7284
add changes to CHANGELOG.md
maple135790 add26cf
remove test changelog in CHANGELOG
maple135790 3660f69
remove variable to be wrapped immediately after
maple135790 6a4cce8
add comment for manually modifying the path
maple135790 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
Directory.current.uri.toFilePath()
makes more sense here than us manually modifying the path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I missed that. Thank you for the mention.
Since the issue trying to fix here is to force yaml using POSIX-like path (here is the lint), so the upcomming fix will use
Directory.current.uri.toFilePath(windows: false)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this fix will encounter another problem.
For example, web path in Windows is
C:\a\b
, the lint suggests the fix is to simply change\
to/
.The correct path is
C:/a/b
.This results
C:/a/b
is not Windows path nor POSIX path, so it cannot be fixed by usinguri.toFilePath(windows: false)
since the output will be something like/C:/a/b/
Perhaps there's an approach to avoid manually modifying the path that I'm unaware of ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it looks like it's not correctly interpreting the
C:
as the authority. We've tried different APIs to see what the right way of emitting a POSIX path from a Windows path is, but everything else also seems janky (maybe adding adirectory:///
or something similar may help, but that doesn't look like it's sufficient anyways), so I'm okay keeping thep.current.replaceAll(r'\', '/')
change you initially had. I'd just add a comment mentioning why we do it like:// Convert the current path to a POSIX path to avoid 'path_not_posix' lint.
Thanks for investigating!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a minor detail, I think the beat looking comment position is above the
writeFile()
because we have full control of the yaml file.There are another two options
Since none of them look concise enough comparing to the above, so I choose to the above over the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it makes sense to keep it outside of the yaml as an implementation detail and place it above
writeFile
.