@@ -381,7 +381,8 @@ impl ToStr for PosixPath {
381381impl GenericPath for PosixPath {
382382
383383 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 ( ) ) }
385386 let is_absolute = ( s. len ( ) != 0 && s[ 0 ] == '/' as u8 ) ;
386387 return PosixPath { is_absolute : is_absolute,
387388 components : components }
@@ -504,9 +505,10 @@ impl GenericPath for PosixPath {
504505 fn push_many ( & self , cs : & [ ~str ] ) -> PosixPath {
505506 let mut v = copy self . components ;
506507 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+ }
510512 unsafe { v. push_all_move ( ss) ; }
511513 }
512514 PosixPath { is_absolute : self . is_absolute ,
@@ -515,7 +517,10 @@ impl GenericPath for PosixPath {
515517
516518 fn push ( & self , s : & str ) -> PosixPath {
517519 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+ }
519524 unsafe { v. push_all_move ( ss) ; }
520525 PosixPath { components : v, ..copy * self }
521526 }
@@ -590,8 +595,10 @@ impl GenericPath for WindowsPath {
590595 }
591596 }
592597
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+ }
595602 let is_absolute = ( rest. len ( ) != 0 && windows:: is_sep ( rest[ 0 ] ) ) ;
596603 return WindowsPath { host : host,
597604 device : device,
@@ -759,9 +766,10 @@ impl GenericPath for WindowsPath {
759766 fn push_many ( & self , cs : & [ ~str ] ) -> WindowsPath {
760767 let mut v = copy self . components ;
761768 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+ }
765773 unsafe { v. push_all_move ( ss) ; }
766774 }
767775 // tedious, but as-is, we can't use ..self
@@ -775,7 +783,10 @@ impl GenericPath for WindowsPath {
775783
776784 fn push ( & self , s : & str ) -> WindowsPath {
777785 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+ }
779790 unsafe { v. push_all_move ( ss) ; }
780791 return WindowsPath { components : v, ..copy * self }
781792 }
0 commit comments