@@ -323,6 +323,11 @@ unsafe fn u8_slice_as_os_str(s: &[u8]) -> &OsStr {
323
323
mem:: transmute ( s)
324
324
}
325
325
326
+ // Detect scheme on Redox
327
+ fn has_redox_scheme ( s : & [ u8 ] ) -> bool {
328
+ cfg ! ( target_os = "redox" ) && s. split ( |b| * b == b'/' ) . next ( ) . unwrap_or ( b"" ) . contains ( & b':' )
329
+ }
330
+
326
331
////////////////////////////////////////////////////////////////////////////////
327
332
// Cross-platform, iterator-independent parsing
328
333
////////////////////////////////////////////////////////////////////////////////
@@ -1685,8 +1690,12 @@ impl Path {
1685
1690
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1686
1691
#[ allow( deprecated) ]
1687
1692
pub fn is_absolute ( & self ) -> bool {
1688
- // FIXME: Remove target_os = "redox" and allow Redox prefixes
1689
- self . has_root ( ) && ( cfg ! ( unix) || cfg ! ( target_os = "redox" ) || self . prefix ( ) . is_some ( ) )
1693
+ if !cfg ! ( target_os = "redox" ) {
1694
+ self . has_root ( ) && ( cfg ! ( unix) || self . prefix ( ) . is_some ( ) )
1695
+ } else {
1696
+ // FIXME: Allow Redox prefixes
1697
+ has_redox_scheme ( self . as_u8_slice ( ) )
1698
+ }
1690
1699
}
1691
1700
1692
1701
/// Returns `true` if the `Path` is relative, i.e. not absolute.
@@ -2050,7 +2059,8 @@ impl Path {
2050
2059
Components {
2051
2060
path : self . as_u8_slice ( ) ,
2052
2061
prefix,
2053
- has_physical_root : has_physical_root ( self . as_u8_slice ( ) , prefix) ,
2062
+ has_physical_root : has_physical_root ( self . as_u8_slice ( ) , prefix) ||
2063
+ has_redox_scheme ( self . as_u8_slice ( ) ) ,
2054
2064
front : State :: Prefix ,
2055
2065
back : State :: Body ,
2056
2066
}
0 commit comments