-
Notifications
You must be signed in to change notification settings - Fork 12
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
Store each path as a Path instead of a String (which is utf8-only) #30
Comments
@bew i was thinking along the same lines when I updated clap, since you can parse arguments as PathBuf instead of string, but then I ended up having to unwrap stuff to match everything else. I agree we should be working with PathBufs when possible, would love for you to take a stab at it |
Or OsString or whatever, not totally sure, I leave it up to you |
That OsString documentation scared me. I'm curious how vim deals with the
issue.
…On Fri, Apr 30, 2021, 5:56 PM Marcus Buffett ***@***.***> wrote:
Or OsString or whatever, not totally sure, I leave it up to you
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE66RMWEZAGOLQFRU3QTJLTLM7TLANCNFSM435NM3AQ>
.
|
Just thinking out loud: wouldn't a change like this:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comment on:
pipe-rename/src/main.rs
Lines 168 to 175 in 5658581
I'm thinking, the filter_map exists only because the conversion from an
OsString
to aString
could fail if the path is not UTF-8 and we might get anErr(...)
instead of anOk(String)
.Edit: the
filter_map
also exists because each entry in fromread_dir
can be an error, my bad.My observation is still valid though and is on:
.into_string().ok()
which will return None for a non-utf8 path, and discard it.I don't think that's right, the tool shouldn't skip non-utf8 paths.
@marcusbuffett I'm wondering if we could change something in the entire codebase:
--> Instead of storing each path in a
String
(utf8), we could simply keep it as aPath
(which can contain non-utf8).For the occasional cases where we need to print a path (like for the diff), we could use a replacement char for the non-utf8 chars. With a note for the user at the end of the diff if at least one path is non-utf8, the detection / change could be done before the diff to not over complicate it.
NOTE: I'd be interested to take a stab at this if you're ok with this
The text was updated successfully, but these errors were encountered: