mem::transmute(s)
}
+// Detect scheme on Redox
+#[inline]
+#[allow(unused_variables)]
+fn has_scheme(s: &[u8]) -> bool {
+ #[cfg(target_os = "redox")]
+ {
+ s.split(|b| *b == b'/').next().unwrap_or(b"").contains(&b':')
+ }
+ #[cfg(not(target_os = "redox"))]
+ {
+ false
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// Cross-platform, iterator-independent parsing
////////////////////////////////////////////////////////////////////////////////
// normalization, e.g. \\server\share == \\server\share\.
has_physical_root: bool,
+ // For Redox
+ has_scheme: bool,
+
// The iterator is double-ended, and these two states keep track of what has
// been produced from either end
front: State,
/// Is the *original* path rooted?
fn has_root(&self) -> bool {
- if self.has_physical_root {
+ if self.has_physical_root || self.has_scheme {
return true;
}
if let Some(p) = self.prefix {
#[cfg(target_os = "redox")]
{
// FIXME: Allow Redox prefixes
- use os::unix::ffi::OsStrExt;
- self.as_os_str().as_bytes().split(|b| *b == b'/').next().unwrap_or(b"").contains(&b':')
+ has_scheme(self.as_u8_slice())
}
}
path: self.as_u8_slice(),
prefix,
has_physical_root: has_physical_root(self.as_u8_slice(), prefix),
+ has_scheme: has_scheme(self.as_u8_slice()),
front: State::Prefix,
back: State::Body,
}