diff options
| author | kennytm <kennytm@gmail.com> | 2017-11-13 17:09:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-13 17:09:41 +0800 |
| commit | 563af5d2607d8e7e4205de5a04c9c7e7c4582677 (patch) | |
| tree | 88b9c665319f2b6904c36e5abea6192ad0e25401 | |
| parent | e3ca816d362c3613055aa1e44f1a0caac111db15 (diff) | |
| parent | ef76ebf28c70d7c68b482295b65be56aaf10588a (diff) | |
| download | rust-563af5d2607d8e7e4205de5a04c9c7e7c4582677.tar.gz rust-563af5d2607d8e7e4205de5a04c9c7e7c4582677.zip | |
Rollup merge of #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 https://github.com/rust-lang/rust/pull/45893
| -rw-r--r-- | src/libstd/path.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 270878dc029..69922470cff 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1690,11 +1690,11 @@ impl Path { #[stable(feature = "rust1", since = "1.0.0")] #[allow(deprecated)] pub fn is_absolute(&self) -> bool { - if !cfg!(target_os = "redox") { - self.has_root() && (cfg!(unix) || self.prefix().is_some()) - } else { + if cfg!(target_os = "redox") { // FIXME: Allow Redox prefixes - has_redox_scheme(self.as_u8_slice()) + self.has_root() || has_redox_scheme(self.as_u8_slice()) + } else { + self.has_root() && (cfg!(unix) || self.prefix().is_some()) } } |
