@@ -381,7 +381,8 @@ impl ToStr for PosixPath {
381
381
impl GenericPath for PosixPath {
382
382
383
383
fn from_str ( s : & str ) -> PosixPath {
384
- let mut components = str:: split_nonempty ( s, |c| c == '/' ) ;
384
+ let mut components = ~[ ] ;
385
+ for str:: each_split_nonempty( s, |c| c == '/' ) |s| { components. push ( s. to_owned ( ) ) }
385
386
let is_absolute = ( s. len ( ) != 0 && s[ 0 ] == '/' as u8 ) ;
386
387
return PosixPath { is_absolute : is_absolute,
387
388
components : components }
@@ -504,9 +505,10 @@ impl GenericPath for PosixPath {
504
505
fn push_many ( & self , cs : & [ ~str ] ) -> PosixPath {
505
506
let mut v = copy self . components ;
506
507
for cs. each |e| {
507
- let mut ss = str:: split_nonempty (
508
- * e,
509
- |c| windows:: is_sep ( c as u8 ) ) ;
508
+ let mut ss = ~[ ] ;
509
+ for str:: each_split_nonempty( * e, |c| windows:: is_sep( c as u8) ) |s| {
510
+ ss. push ( s. to_owned ( ) )
511
+ }
510
512
unsafe { v. push_all_move ( ss) ; }
511
513
}
512
514
PosixPath { is_absolute : self . is_absolute ,
@@ -515,7 +517,10 @@ impl GenericPath for PosixPath {
515
517
516
518
fn push ( & self , s : & str ) -> PosixPath {
517
519
let mut v = copy self . components ;
518
- let mut ss = str:: split_nonempty ( s, |c| windows:: is_sep ( c as u8 ) ) ;
520
+ let mut ss = ~[ ] ;
521
+ for str:: each_split_nonempty( s, |c| windows:: is_sep( c as u8) ) |s| {
522
+ ss. push ( s. to_owned ( ) )
523
+ }
519
524
unsafe { v. push_all_move ( ss) ; }
520
525
PosixPath { components : v, ..copy * self }
521
526
}
@@ -590,8 +595,10 @@ impl GenericPath for WindowsPath {
590
595
}
591
596
}
592
597
593
- let mut components =
594
- str:: split_nonempty ( rest, |c| windows:: is_sep ( c as u8 ) ) ;
598
+ let mut components = ~[ ] ;
599
+ for str:: each_split_nonempty( rest, |c| windows:: is_sep( c as u8) ) |s| {
600
+ components. push ( s. to_owned ( ) )
601
+ }
595
602
let is_absolute = ( rest. len ( ) != 0 && windows:: is_sep ( rest[ 0 ] ) ) ;
596
603
return WindowsPath { host : host,
597
604
device : device,
@@ -759,9 +766,10 @@ impl GenericPath for WindowsPath {
759
766
fn push_many ( & self , cs : & [ ~str ] ) -> WindowsPath {
760
767
let mut v = copy self . components ;
761
768
for cs. each |e| {
762
- let mut ss = str:: split_nonempty (
763
- * e,
764
- |c| windows:: is_sep ( c as u8 ) ) ;
769
+ let mut ss = ~[ ] ;
770
+ for str:: each_split_nonempty( * e, |c| windows:: is_sep( c as u8) ) |s| {
771
+ ss. push ( s. to_owned ( ) )
772
+ }
765
773
unsafe { v. push_all_move ( ss) ; }
766
774
}
767
775
// tedious, but as-is, we can't use ..self
@@ -775,7 +783,10 @@ impl GenericPath for WindowsPath {
775
783
776
784
fn push ( & self , s : & str ) -> WindowsPath {
777
785
let mut v = copy self . components ;
778
- let mut ss = str:: split_nonempty ( s, |c| windows:: is_sep ( c as u8 ) ) ;
786
+ let mut ss = ~[ ] ;
787
+ for str:: each_split_nonempty( s, |c| windows:: is_sep( c as u8) ) |s| {
788
+ ss. push ( s. to_owned ( ) )
789
+ }
779
790
unsafe { v. push_all_move ( ss) ; }
780
791
return WindowsPath { components : v, ..copy * self }
781
792
}
0 commit comments