-
Notifications
You must be signed in to change notification settings - Fork 13.3k
path empty #3420
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
Comments
Should The structure holding Path is meant to be inspected directly if you like, so |
I'd say the use case is the conversion of a string to a Path where the path is supposed to point to something that may or may not exist. These will often come from a config file or command line so there is a desire to do some preflighting or asserts to make sure that the path is sane. Perhaps the thing to do is provide some sort if is_well_formed method that checks for one or more components plus no bad characters for the current file system (WIndows, at least, has a lot of these). Regardless I would like a more visible abstraction than checking that components is non-empty. Or alternatively just fail if from_str is called with something not well formed. |
If from_str does fail there still needs to be a way for users to test paths so that they can error out gracefully, and error out early, instead of trundling along until the code finally tries to use the bad path. |
non-critical for 0.6, de-milestoning |
@jesse99 Would having |
Do we want to have a notion of an "empty" path build into |
visiting for triage. @kballard you know |
I do not believe that we should support the notion of an empty |
@kballard thanks for your input. I'll close this bug based on the feedback provided in the previous comments. Feel free to re-open if you think this could be useful. |
add eyre to test-cargo-miri Same as anyhow: custom build probe, widely used.
In porting my code over to the new Path struct(s) there are a number of places where I wanted to see if a path was set. For now I am using
str::is_not_empty(some_path.to_str()
which I am not crazy about because it's going to allocate a string and, more importantly, because I'm not sure that ~"" will be round trippable for all file systems.Note that boost file system has an empty method for just this purpose.
The text was updated successfully, but these errors were encountered: