@@ -215,6 +215,7 @@ pub fn download_or_update_extra(app: &AppHandle, path: PathBuf, package_id: Stri
215215 } ) ;
216216 return ;
217217 } else {
218+ let ap = if package_type. as_str ( ) == "xxmi" || package_id. as_str ( ) == "jadeite" || package_id == "keqingunlock" { path. clone ( ) } else { path. join ( & package_type) } ;
218219 let ver_path = if package_id == "keqingunlock" || package_id == "jadeite" || package_type == "xxmi" { path. join ( "VERSION.txt" ) } else { path. join ( package_type. clone ( ) ) . join ( "VERSION.txt" ) } ;
219220 if !ver_path. exists ( ) { return ; }
220221 let pkg_type = if package_id == "keqingunlock" || package_id == "jadeite" { package_id. as_str ( ) } else { package_type. as_str ( ) } ;
@@ -230,21 +231,22 @@ pub fn download_or_update_extra(app: &AppHandle, path: PathBuf, package_id: Stri
230231 let f_path = path. join ( file) ;
231232 if f_path. exists ( ) { let _ = fs:: remove_file ( f_path) ; }
232233 }
233- } else { let ap = path . join ( package_type . clone ( ) ) ; empty_dir ( & ap) . unwrap ( ) ; }
234+ } else { empty_dir ( & ap) . unwrap ( ) ; }
234235 prevent_exit ( & app, true ) ;
235236 let dl = run_async_command ( async {
236- let needs_extract = if package_type. as_str ( ) == "keqing_unlock" { false } else { true } ;
237+ let needs_extract = if package_type. as_str ( ) == "keqing_unlock" || package_type . as_str ( ) == "xxmi" { false } else { true } ;
237238 let needs_append = if package_type. as_str ( ) == "gimi" || package_type. as_str ( ) == "srmi" || package_type. as_str ( ) == "zzmi" || package_type. as_str ( ) == "himi" || package_type. as_str ( ) == "wwmi" { true } else { false } ;
238- Extras :: download_extra_package ( package_id. clone ( ) , package_type. clone ( ) , needs_extract, false , needs_append, path . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , |_current, _total| { } ) . await
239+ Extras :: download_extra_package ( package_id. clone ( ) , package_type. clone ( ) , needs_extract, false , needs_append, ap . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , |_current, _total| { } ) . await
239240 } ) ;
240241 if dl {
241242 if package_type. as_str ( ) == "gimi" || package_type. as_str ( ) == "srmi" || package_type. as_str ( ) == "zzmi" || package_type. as_str ( ) == "himi" || package_type. as_str ( ) == "wwmi" {
242243 for mi in [ "gimi" , "srmi" , "zzmi" , "wwmi" , "himi" ] {
243244 for lib in [ "d3d11.dll" , "d3dcompiler_47.dll" ] {
244245 let linkedpath = path. join ( mi) . join ( lib) ;
246+ let _ = fs:: remove_file ( & linkedpath) ;
245247 if !linkedpath. exists ( ) {
246248 #[ cfg( target_os = "linux" ) ]
247- if !linkedpath . exists ( ) { std:: os:: unix:: fs:: symlink ( path. join ( lib) , linkedpath) . unwrap ( ) ; }
249+ std:: os:: unix:: fs:: symlink ( path. join ( lib) , linkedpath) . unwrap ( ) ;
248250 #[ cfg( target_os = "windows" ) ]
249251 fs:: copy ( path. join ( lib) , linkedpath) . unwrap ( ) ;
250252 }
@@ -285,10 +287,11 @@ pub fn download_or_update_extra(app: &AppHandle, path: PathBuf, package_id: Stri
285287 app. emit ( "download_progress" , dlpayload. clone ( ) ) . unwrap ( ) ;
286288 prevent_exit ( & app, true ) ;
287289
290+ if !ap. exists ( ) { let _ = fs:: create_dir_all ( & ap) ; }
288291 let dl = run_async_command ( async {
289- let needs_extract = if package_type. as_str ( ) == "keqing_unlock" { false } else { true } ;
292+ let needs_extract = if package_type. as_str ( ) == "keqing_unlock" || package_type . as_str ( ) == "xxmi" { false } else { true } ;
290293 let needs_append = if package_type. as_str ( ) == "gimi" || package_type. as_str ( ) == "srmi" || package_type. as_str ( ) == "zzmi" || package_type. as_str ( ) == "himi" || package_type. as_str ( ) == "wwmi" { true } else { false } ;
291- Extras :: download_extra_package ( package_id. clone ( ) , package_type. clone ( ) , needs_extract, false , needs_append, path . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , {
294+ Extras :: download_extra_package ( package_id. clone ( ) , package_type. clone ( ) , needs_extract, false , needs_append, ap . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , {
292295 let app = app. clone ( ) ;
293296 let pkg_id = package_id. clone ( ) ;
294297 let dlpayload = dlpayload. clone ( ) ;
@@ -306,9 +309,10 @@ pub fn download_or_update_extra(app: &AppHandle, path: PathBuf, package_id: Stri
306309 for mi in [ "gimi" , "srmi" , "zzmi" , "wwmi" , "himi" ] {
307310 for lib in [ "d3d11.dll" , "d3dcompiler_47.dll" ] {
308311 let linkedpath = path. join ( mi) . join ( lib) ;
312+ let _ = fs:: remove_file ( & linkedpath) ;
309313 if !linkedpath. exists ( ) {
310314 #[ cfg( target_os = "linux" ) ]
311- if !linkedpath . exists ( ) { std:: os:: unix:: fs:: symlink ( path. join ( lib) , linkedpath) . unwrap ( ) ; }
315+ std:: os:: unix:: fs:: symlink ( path. join ( lib) , linkedpath) . unwrap ( ) ;
312316 #[ cfg( target_os = "windows" ) ]
313317 fs:: copy ( path. join ( lib) , linkedpath) . unwrap ( ) ;
314318 }
0 commit comments