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.
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
Remove the
directories
dependency #4904Remove the
directories
dependency #4904Changes from all commits
45a45b8
5711747
8da57a2
e78a47c
8bd8072
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This doesn't seems enough to sanitize the path 😬
https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names
I suggest we replace all characters not in
[a-zA-Z0-9_-]
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.
This is actually just replicating what the directories crate does.
The Linux impl changes the text to lowercase and removes spaces:
https://github.com/dirs-dev/directories-rs/blob/da65f064a8bb18d790600433fadeed17a54c793a/src/lin.rs#L92-L110
The macOS impl changes the spaces to dashes:
https://github.com/dirs-dev/directories-rs/blob/da65f064a8bb18d790600433fadeed17a54c793a/src/mac.rs#L91-L98
And the Windows impl doesn't change anything:
https://github.com/dirs-dev/directories-rs/blob/da65f064a8bb18d790600433fadeed17a54c793a/src/win.rs#L98-L100
I suppose we could be more strict, but for now I'm just trying to remove the dependency with minimal changes to the functionality.
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.
Could also use the known-folders crate, which has this function and nothing else. But it's still another dependency, which might end up pulling a different version of windows-sys, so I don't know if it's worth it.