-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
create_dir_all("")
should complain about invalid filename
#105108
Comments
P.S. $ cargo run
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:2:29 I would expect to see the same message from |
Here is what I have found:
I think you're right in that the proper behaviour would be just to produce an error message in the |
For some history see #23383. Though a lot has changed in 7 years. |
Thanks for the info, Chris. |
Since |
The behavior makes sense because `Path::new("one_component").parent() == Some(Path::new(""))`, so if one naively wants to create the parent directory for a file to be written, it simply works. Closes rust-lang#105108 by documenting the current behavior.
…olnay Document behavior of `create_dir_all` wrt. empty path The behavior makes sense because `Path::new("one_component").parent() == Some(Path::new(""))`, so if one naively wants to create the parent directory for a file to be written, it simply works. Closes rust-lang#105108 by documenting the current behavior.
Rollup merge of rust-lang#125112 - tbu-:pr_create_dir_all_empty, r=dtolnay Document behavior of `create_dir_all` wrt. empty path The behavior makes sense because `Path::new("one_component").parent() == Some(Path::new(""))`, so if one naively wants to create the parent directory for a file to be written, it simply works. Closes rust-lang#105108 by documenting the current behavior.
I tried this code:
The filename is invalid, so I've expected to see some error similar to posix utils:
Instead, nothing interesting happened,
create_dir_all
succeeded.Meta
The text was updated successfully, but these errors were encountered: