@@ -64,6 +64,8 @@ pub trait GenericPath {
64
64
pure fn push_many( ( & [ ~str ] ) ) -> Self ;
65
65
pure fn pop( ) -> Self ;
66
66
67
+ pure fn unsafe_join( ( & Self ) ) -> Self ;
68
+
67
69
pure fn normalize( ) -> Self ;
68
70
}
69
71
@@ -485,6 +487,15 @@ impl GenericPath for PosixPath {
485
487
self . push_many ( other. components )
486
488
}
487
489
490
+ pure fn unsafe_join ( other : & PosixPath ) -> PosixPath {
491
+ if other. is_absolute {
492
+ PosixPath { is_absolute : true ,
493
+ components : copy other. components }
494
+ } else {
495
+ self . push_rel ( other)
496
+ }
497
+ }
498
+
488
499
pure fn push_many ( cs : & [ ~str ] ) -> PosixPath {
489
500
let mut v = copy self . components ;
490
501
for cs. each |e| {
@@ -685,6 +696,25 @@ impl GenericPath for WindowsPath {
685
696
self . push_many ( other. components )
686
697
}
687
698
699
+ pure fn unsafe_join ( other : & WindowsPath ) -> WindowsPath {
700
+ if !other. is_absolute {
701
+ self . push_rel ( other)
702
+ } else {
703
+ WindowsPath {
704
+ host : match other. host {
705
+ None => copy self . host ,
706
+ Some ( copy x) => Some ( x)
707
+ } ,
708
+ device : match other. device {
709
+ None => copy self . device ,
710
+ Some ( copy x) => Some ( x)
711
+ } ,
712
+ is_absolute : true ,
713
+ components : copy other. components
714
+ }
715
+ }
716
+ }
717
+
688
718
pure fn push_many ( cs : & [ ~str ] ) -> WindowsPath {
689
719
let mut v = copy self . components ;
690
720
for cs. each |e| {
0 commit comments