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 @@ -144,21 +144,34 @@ pub struct ExtractEszipPayload {
144
144
pub folder : PathBuf ,
145
145
}
146
146
147
+ fn ensure_unix_relative_path ( path : & Path ) -> & Path {
148
+ assert ! ( path. is_relative( ) ) ;
149
+ assert ! ( !path. to_string_lossy( ) . starts_with( '\\' ) ) ;
150
+ path
151
+ }
152
+
147
153
fn create_module_path ( global_specifier : & str , entry_path : & Path , output_folder : & Path ) -> PathBuf {
148
154
let cleaned_specifier = global_specifier. replace ( entry_path. to_str ( ) . unwrap ( ) , "" ) ;
149
155
let module_path = PathBuf :: from ( cleaned_specifier) ;
150
156
151
157
if let Some ( parent) = module_path. parent ( ) {
152
158
if parent. parent ( ) . is_some ( ) {
153
- let output_folder_and_mod_folder =
154
- output_folder. join ( parent. strip_prefix ( "/" ) . unwrap ( ) ) ;
159
+ let output_folder_and_mod_folder = output_folder. join (
160
+ parent
161
+ . strip_prefix ( "/" )
162
+ . unwrap_or_else ( |_| ensure_unix_relative_path ( parent) ) ,
163
+ ) ;
155
164
if !output_folder_and_mod_folder. exists ( ) {
156
165
create_dir_all ( & output_folder_and_mod_folder) . unwrap ( ) ;
157
166
}
158
167
}
159
168
}
160
169
161
- output_folder. join ( module_path. strip_prefix ( "/" ) . unwrap ( ) )
170
+ output_folder. join (
171
+ module_path
172
+ . strip_prefix ( "/" )
173
+ . unwrap_or_else ( |_| ensure_unix_relative_path ( & module_path) ) ,
174
+ )
162
175
}
163
176
164
177
async fn extract_modules (
You can’t perform that action at this time.
0 commit comments