File tree Expand file tree Collapse file tree 2 files changed +14
-21
lines changed Expand file tree Collapse file tree 2 files changed +14
-21
lines changed Original file line number Diff line number Diff line change 11enableGlobalCache : true
22
3- globalFolder : " D:\\ yarn-global"
4-
53nodeLinker : pnp
Original file line number Diff line number Diff line change @@ -33,43 +33,36 @@ impl<T> Trie<T> {
3333}
3434
3535pub fn normalize_path < P : AsRef < str > > ( original : P ) -> String {
36- let original_str
37- = original. as_ref ( ) ;
36+ let original_str = original. as_ref ( ) ;
3837
39- let check_str_root
40- = original_str. strip_prefix ( "/" ) ;
41- let str_minus_root
42- = check_str_root. unwrap_or ( original_str) ;
38+ let check_str_root = original_str. strip_prefix ( "/" ) ;
39+ let str_minus_root = check_str_root. unwrap_or ( original_str) ;
4340
44- let components
45- = str_minus_root. split ( & [ '/' , '\\' ] [ ..] ) ;
41+ let components = str_minus_root. split ( & [ '/' , '\\' ] [ ..] ) ;
4642
47- let mut out: Vec < & str >
48- = Vec :: new ( ) ;
43+ let mut out: Vec < & str > = Vec :: new ( ) ;
4944
5045 for comp in components {
5146 match comp {
5247 "" | "." => {
5348 // Those components don't progress the path
54- } ,
49+ }
5550
5651 ".." => match out. last ( ) {
5752 None if check_str_root. is_some ( ) => {
5853 // No need to add a ".." since we're already at the root
59- } ,
54+ }
6055
6156 Some ( & ".." ) | None => {
6257 out. push ( comp) ;
63- } ,
58+ }
6459
6560 Some ( _) => {
6661 out. pop ( ) ;
67- } ,
62+ }
6863 } ,
6964
70- comp => {
71- out. push ( comp)
72- } ,
65+ comp => out. push ( comp) ,
7366 }
7467 }
7568
@@ -81,8 +74,7 @@ pub fn normalize_path<P: AsRef<str>>(original: P) -> String {
8174 }
8275 }
8376
84- let mut str
85- = out. join ( "/" ) ;
77+ let mut str = out. join ( "/" ) ;
8678
8779 if out. is_empty ( ) {
8880 return "." . to_string ( ) ;
@@ -94,6 +86,9 @@ pub fn normalize_path<P: AsRef<str>>(original: P) -> String {
9486 str. push ( '/' ) ;
9587 }
9688
89+ println ! ( "{}" , original_str) ;
90+ println ! ( "-> {}" , str ) ;
91+
9792 str
9893}
9994
You can’t perform that action at this time.
0 commit comments