File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -606,8 +606,8 @@ impl Pattern {
606606 let mut is_recursive = false ;
607607 let mut i = 0 ;
608608
609- #[ cfg( not( windows) ) ]
610609 if let ( Some ( first_char) , second_char) = ( chars. first ( ) , chars. get ( 1 ) ) {
610+ #[ cfg( not( windows) ) ]
611611 match ( * first_char, second_char) {
612612 ( '~' , None ) | ( '~' , Some ( '/' ) ) => {
613613 if let Ok ( home_dir) = std:: env:: var ( "HOME" ) {
@@ -619,6 +619,18 @@ impl Pattern {
619619 }
620620 _ => { }
621621 }
622+ #[ cfg( windows) ]
623+ match ( * first_char, second_char) {
624+ ( '~' , None ) | ( '~' , Some ( '/' ) ) | ( '~' , Some ( '\\' ) ) => {
625+ if let Ok ( home_dir) = std:: env:: var ( "USERPROFILE" ) {
626+ for ch in home_dir. chars ( ) {
627+ tokens. push ( PatternToken :: Char ( ch) ) ;
628+ }
629+ i += 1 ;
630+ }
631+ }
632+ _ => { }
633+ }
622634 }
623635 while i < chars. len ( ) {
624636 match chars[ i] {
You can’t perform that action at this time.
0 commit comments