@@ -323,6 +323,11 @@ unsafe fn u8_slice_as_os_str(s: &[u8]) -> &OsStr {
323323 mem:: transmute ( s)
324324}
325325
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+
326331////////////////////////////////////////////////////////////////////////////////
327332// Cross-platform, iterator-independent parsing
328333////////////////////////////////////////////////////////////////////////////////
@@ -1685,8 +1690,12 @@ impl Path {
16851690 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
16861691 #[ allow( deprecated) ]
16871692 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+ }
16901699 }
16911700
16921701 /// Returns `true` if the `Path` is relative, i.e. not absolute.
@@ -2050,7 +2059,8 @@ impl Path {
20502059 Components {
20512060 path : self . as_u8_slice ( ) ,
20522061 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 ( ) ) ,
20542064 front : State :: Prefix ,
20552065 back : State :: Body ,
20562066 }
0 commit comments