File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -134,21 +134,34 @@ pub struct ExtractEszipPayload {
134
134
pub folder : PathBuf ,
135
135
}
136
136
137
+ fn ensure_unix_relative_path ( path : & Path ) -> & Path {
138
+ assert ! ( path. is_relative( ) ) ;
139
+ assert ! ( !path. to_string_lossy( ) . starts_with( "\\ " ) ) ;
140
+ path
141
+ }
142
+
137
143
fn create_module_path ( global_specifier : & str , entry_path : & Path , output_folder : & Path ) -> PathBuf {
138
144
let cleaned_specifier = global_specifier. replace ( entry_path. to_str ( ) . unwrap ( ) , "" ) ;
139
145
let module_path = PathBuf :: from ( cleaned_specifier) ;
140
146
141
147
if let Some ( parent) = module_path. parent ( ) {
142
148
if parent. parent ( ) . is_some ( ) {
143
- let output_folder_and_mod_folder =
144
- output_folder. join ( parent. strip_prefix ( "/" ) . unwrap ( ) ) ;
149
+ let output_folder_and_mod_folder = output_folder. join (
150
+ parent
151
+ . strip_prefix ( "/" )
152
+ . unwrap_or_else ( |_| ensure_unix_relative_path ( parent) ) ,
153
+ ) ;
145
154
if !output_folder_and_mod_folder. exists ( ) {
146
155
create_dir_all ( & output_folder_and_mod_folder) . unwrap ( ) ;
147
156
}
148
157
}
149
158
}
150
159
151
- output_folder. join ( module_path. strip_prefix ( "/" ) . unwrap ( ) )
160
+ output_folder. join (
161
+ module_path
162
+ . strip_prefix ( "/" )
163
+ . unwrap_or_else ( |_| ensure_unix_relative_path ( & module_path) ) ,
164
+ )
152
165
}
153
166
154
167
async fn extract_modules (
You can’t perform that action at this time.
0 commit comments