Skip to content

Commit 563af5d

Browse files
authored
Rollup merge of rust-lang#45892 - redox-os:is_absolute_fix, r=alexcrichton
Redox: Return true from Path::is_absolute if a Path contains root or a scheme In Redox, different subsystems have different filesystem paths. However, the majority of applications using the `Path::is_absolute` function really only want to know if a path is absolute from the perspective of the scheme it is currently running in, usually `file:`. This makes both `file:/` and `/` return `true` from `Path::is_absolute`, meaning that most code does not have to check if it is running on Redox. Code that wants to know if a path contains a scheme can implement such a check on its own. Related to rust-lang#45893
2 parents e3ca816 + ef76ebf commit 563af5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/path.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,11 +1690,11 @@ impl Path {
16901690
#[stable(feature = "rust1", since = "1.0.0")]
16911691
#[allow(deprecated)]
16921692
pub fn is_absolute(&self) -> bool {
1693-
if !cfg!(target_os = "redox") {
1694-
self.has_root() && (cfg!(unix) || self.prefix().is_some())
1695-
} else {
1693+
if cfg!(target_os = "redox") {
16961694
// FIXME: Allow Redox prefixes
1697-
has_redox_scheme(self.as_u8_slice())
1695+
self.has_root() || has_redox_scheme(self.as_u8_slice())
1696+
} else {
1697+
self.has_root() && (cfg!(unix) || self.prefix().is_some())
16981698
}
16991699
}
17001700

0 commit comments

Comments
 (0)