read_dir() throws me back into std::path::Path
gralpli opened this issue · comments
let path = Utf8Path::new("/some/path");
for entry in path.read_dir()? {
let entry = entry?;
let this_returns_an_OsString = entry.file_name(); // should be String
let this_returns_a_PathBuf = entry.path(); // should be Utf8Path
}
Thanks for the report! Camino's behavior is correct: a utf8 directory path might contain a non-utf8 file name.
I'm happy to consider suggestions like adding a read_dir_utf8
though.
I'd love something like read_dir_utf8
since when I use Camino I know that all paths will be UTF8 (and if any is not then it's considered to be an error).