@@ -67,6 +67,8 @@ pub trait GenericPath {
67
67
fn is_restricted ( & self ) -> bool ;
68
68
69
69
fn normalize ( & self ) -> Self ;
70
+
71
+ fn is_absolute ( & self ) -> bool ;
70
72
}
71
73
72
74
#[ cfg( windows) ]
@@ -379,10 +381,11 @@ impl ToStr for PosixPath {
379
381
// FIXME (#3227): when default methods in traits are working, de-duplicate
380
382
// PosixPath and WindowsPath, most of their methods are common.
381
383
impl GenericPath for PosixPath {
382
-
383
384
fn from_str ( s : & str ) -> PosixPath {
384
385
let mut components = ~[ ] ;
385
- for str:: each_split_nonempty( s, |c| c == '/' ) |s| { components. push ( s. to_owned ( ) ) }
386
+ for str:: each_split_nonempty( s, |c| c == '/' ) |s| {
387
+ components. push ( s. to_owned ( ) )
388
+ }
386
389
let is_absolute = ( s. len ( ) != 0 && s[ 0 ] == '/' as u8 ) ;
387
390
return PosixPath { is_absolute : is_absolute,
388
391
components : components }
@@ -540,6 +543,10 @@ impl GenericPath for PosixPath {
540
543
// ..self
541
544
}
542
545
}
546
+
547
+ fn is_absolute ( & self ) -> bool {
548
+ self . is_absolute
549
+ }
543
550
}
544
551
545
552
@@ -563,7 +570,6 @@ impl ToStr for WindowsPath {
563
570
564
571
565
572
impl GenericPath for WindowsPath {
566
-
567
573
fn from_str ( s : & str ) -> WindowsPath {
568
574
let host;
569
575
let device;
@@ -809,6 +815,10 @@ impl GenericPath for WindowsPath {
809
815
components : normalize ( self . components )
810
816
}
811
817
}
818
+
819
+ fn is_absolute ( & self ) -> bool {
820
+ self . is_absolute
821
+ }
812
822
}
813
823
814
824
0 commit comments