modify ui

This commit is contained in:
Julian Freeman
2025-12-08 11:01:22 -04:00
parent 618fd2d933
commit fd28d4764a
7 changed files with 20 additions and 11 deletions

View File

@@ -204,22 +204,31 @@ pub async fn download_qjs(app: &AppHandle) -> Result<PathBuf> {
let source_name = get_qjs_source_name_in_zip();
let target_name = get_qjs_binary_name(); // quickjs.exe or quickjs
let mut found = false;
let mut found_exe = false;
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
// Filenames in zip might be like "quickjs-win-x86_64-2024-01-13/qjs.exe"
let name = file.name();
let name = file.name().to_string();
// Skip directories
if file.is_dir() {
continue;
}
let filename_only = name.split('/').last().unwrap_or("");
if filename_only == source_name {
let mut out_file = fs::File::create(bin_dir.join(target_name))?;
std::io::copy(&mut file, &mut out_file)?;
found = true;
break;
found_exe = true;
} else if filename_only.ends_with(".dll") {
// Extract DLLs (needed for Windows MinGW builds, e.g. libwinpthread-1.dll)
let mut out_file = fs::File::create(bin_dir.join(filename_only))?;
std::io::copy(&mut file, &mut out_file)?;
}
}
if !found {
if !found_exe {
return Err(anyhow!("在下载的压缩包中找不到 {}", source_name));
}