Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
488 changes: 45 additions & 443 deletions library/std/src/path.rs

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions library/std/src/sys/path/cygwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ pub const fn is_verbatim_sep(b: u8) -> bool {

pub use super::windows_prefix::parse_prefix;

pub const HAS_PREFIXES: bool = true;

unsafe extern "C" {
// Doc: https://cygwin.com/cygwin-api/func-cygwin-conv-path.html
// Src: https://github.com/cygwin/cygwin/blob/718a15ba50e0d01c79800bd658c2477f9a603540/winsup/cygwin/path.cc#L3902
Expand Down Expand Up @@ -55,7 +53,7 @@ pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> {
Ok(PathBuf::from(OsString::from_vec(buffer)))
})
.map(|path| {
if path.prefix().is_some() {
if path.components().0.prefix().is_some() {
return path;
}

Expand All @@ -81,7 +79,7 @@ pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> {

pub(crate) fn is_absolute(path: &Path) -> bool {
if path.as_os_str().as_encoded_bytes().starts_with(b"\\") {
path.has_root() && path.prefix().is_some()
path.has_root() && path.components().0.prefix().is_some()
} else {
path.has_root()
}
Expand Down
12 changes: 12 additions & 0 deletions library/std/src/sys/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,41 @@ macro_rules! path_separator_bytes {

cfg_select! {
target_os = "windows" => {
mod prefixed_paths;
mod windows;
mod windows_prefix;
pub use prefixed_paths::*;
pub use windows::*;
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod nonprefixed_paths;
mod sgx;
pub use nonprefixed_paths::*;
pub use sgx::*;
}
target_os = "solid_asp3" => {
mod prefixed_paths;
mod unsupported_backslash;
pub use prefixed_paths::*;
pub use unsupported_backslash::*;
}
target_os = "uefi" => {
mod prefixed_paths;
mod uefi;
pub use prefixed_paths::*;
pub use uefi::*;
}
target_os = "cygwin" => {
mod cygwin;
mod prefixed_paths;
mod windows_prefix;
pub use cygwin::*;
pub use prefixed_paths::*;
}
_ => {
mod nonprefixed_paths;
mod unix;
pub use nonprefixed_paths::*;
pub use unix::*;
}
}
Loading
Loading