-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`S-waiting-on-teamStatus: Awaiting decision from the relevant subteam (see the T-<team> label).Status: Awaiting decision from the relevant subteam (see the T-<team> label).T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-closeThis PR / issue is in PFCP or FCP with a disposition to close it.This PR / issue is in PFCP or FCP with a disposition to close it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
Path::parent
returns Some("")
for relative paths like foo.txt
, but read_dir
throws an error when given ""
, so code like if let Some(parent) = path.parent() { std::fs::read_dir(parent) }
fails for files in the working directory.
Additionally, calling read_dir
on a relative file without a ./
prefix returns file paths without ./
prefixes, but there is no way to achieve similar behavior for the working directory because read_dir("")
throws an error. read_dir(".")
returns file paths with ./
prefixes and is not a solution.
This was tested on Unix, and may be Unix-specific, but I lack a Windows machine to easily test against.
teor2345
Metadata
Metadata
Assignees
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`S-waiting-on-teamStatus: Awaiting decision from the relevant subteam (see the T-<team> label).Status: Awaiting decision from the relevant subteam (see the T-<team> label).T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-closeThis PR / issue is in PFCP or FCP with a disposition to close it.This PR / issue is in PFCP or FCP with a disposition to close it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.