|
@@ -197,12 +197,13 @@ pub async fn install_software(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 发送安装状态事件
|
|
// 发送安装状态事件
|
|
|
- let emit_status = |message: &str, progress: f64, i18n_key: Option<&str>| {
|
|
|
|
|
|
|
+ let emit_status = |message: &str, progress: f64, i18n_key: Option<&str>, skip_log: bool| {
|
|
|
let _ = app.emit("install-status", serde_json::json!({
|
|
let _ = app.emit("install-status", serde_json::json!({
|
|
|
"software": software,
|
|
"software": software,
|
|
|
"message": message,
|
|
"message": message,
|
|
|
"progress": progress,
|
|
"progress": progress,
|
|
|
"i18nKey": i18n_key,
|
|
"i18nKey": i18n_key,
|
|
|
|
|
+ "skipLog": skip_log,
|
|
|
}));
|
|
}));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -304,10 +305,10 @@ async fn install_nodejs<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("Preparing to install Node.js...", 0.0, Some("install.preparing"));
|
|
|
|
|
|
|
+ emit_status("Preparing to install Node.js...", 0.0, Some("install.preparing"), false);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -321,7 +322,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Downloading Node.js...", 10.0, Some("install.downloading"));
|
|
|
|
|
|
|
+ emit_status("Downloading Node.js...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
|
// 构建下载 URL
|
|
// 构建下载 URL
|
|
|
let download_url = format!(
|
|
let download_url = format!(
|
|
@@ -342,13 +343,13 @@ where
|
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
|
let current_percent = percent as i32;
|
|
let current_percent = percent as i32;
|
|
|
- // 每 5% 记录一次日志,但每次都更新进度条
|
|
|
|
|
- let should_log = current_percent - last_logged_percent >= 5;
|
|
|
|
|
|
|
+ // 每 10% 记录一次日志,但每次都更新进度条
|
|
|
|
|
+ let should_log = current_percent - last_logged_percent >= 10;
|
|
|
if should_log {
|
|
if should_log {
|
|
|
- last_logged_percent = (current_percent / 5) * 5;
|
|
|
|
|
|
|
+ last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
- let message = format!("Downloading Node.js... ({:.1}MB / {:.1}MB)", downloaded_mb, total_mb);
|
|
|
|
|
- emit_status(&message, progress, Some("install.downloading.progress"));
|
|
|
|
|
|
|
+ let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
@@ -360,7 +361,7 @@ where
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- emit_status("Installing Node.js...", 55.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("安装中...", 55.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 执行安装
|
|
// 执行安装
|
|
|
let mut args = vec!["/i", msi_path.to_str().unwrap(), "/qn"];
|
|
let mut args = vec!["/i", msi_path.to_str().unwrap(), "/qn"];
|
|
@@ -378,7 +379,7 @@ where
|
|
|
let _ = std::fs::remove_file(&msi_path);
|
|
let _ = std::fs::remove_file(&msi_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("Node.js installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Node.js installed successfully".to_string(),
|
|
message: "Node.js installed successfully".to_string(),
|
|
@@ -391,7 +392,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Node.js via Homebrew...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("Installing Node.js via Homebrew...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
@@ -400,7 +401,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("Node.js installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Node.js installed successfully".to_string(),
|
|
message: "Node.js installed successfully".to_string(),
|
|
@@ -413,7 +414,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Node.js...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("Installing Node.js...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 使用 NodeSource 安装
|
|
// 使用 NodeSource 安装
|
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
@@ -431,7 +432,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if install_output.status.success() {
|
|
if install_output.status.success() {
|
|
|
- emit_status("Node.js installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Node.js installed successfully".to_string(),
|
|
message: "Node.js installed successfully".to_string(),
|
|
@@ -451,10 +452,10 @@ async fn install_pnpm<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing pnpm...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("安装中...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -469,7 +470,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("pnpm installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "pnpm installed successfully".to_string(),
|
|
message: "pnpm installed successfully".to_string(),
|
|
@@ -489,10 +490,10 @@ async fn install_vscode<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("Preparing to install VS Code...", 0.0, Some("install.preparing"));
|
|
|
|
|
|
|
+ emit_status("正在准备安装...", 0.0, Some("install.preparing"), false);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -504,7 +505,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Downloading VS Code...", 10.0, Some("install.downloading"));
|
|
|
|
|
|
|
+ emit_status("正在下载...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64";
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64";
|
|
|
|
|
|
|
@@ -520,16 +521,16 @@ where
|
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
|
let current_percent = percent as i32;
|
|
let current_percent = percent as i32;
|
|
|
- // 每 5% 记录一次日志
|
|
|
|
|
- let should_log = current_percent - last_logged_percent >= 5;
|
|
|
|
|
|
|
+ // 每 10% 记录一次日志
|
|
|
|
|
+ let should_log = current_percent - last_logged_percent >= 10;
|
|
|
if should_log {
|
|
if should_log {
|
|
|
- last_logged_percent = (current_percent / 5) * 5;
|
|
|
|
|
|
|
+ last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
- let message = format!("Downloading VS Code... ({:.1}MB / {:.1}MB)", downloaded_mb, total_mb);
|
|
|
|
|
- emit_status(&message, progress, Some("install.downloading.progress"));
|
|
|
|
|
|
|
+ let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
- emit_status("Installing VS Code...", 65.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("安装中...", 65.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART", "/MERGETASKS=!runcode"];
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART", "/MERGETASKS=!runcode"];
|
|
|
|
|
|
|
@@ -544,7 +545,7 @@ where
|
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("VS Code installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "VS Code installed successfully".to_string(),
|
|
message: "VS Code installed successfully".to_string(),
|
|
@@ -557,14 +558,14 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing VS Code via Homebrew...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("Installing VS Code via Homebrew...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let output = run_shell_hidden("brew install --cask visual-studio-code")
|
|
let output = run_shell_hidden("brew install --cask visual-studio-code")
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("VS Code installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "VS Code installed successfully".to_string(),
|
|
message: "VS Code installed successfully".to_string(),
|
|
@@ -577,7 +578,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Downloading VS Code...", 10.0, Some("install.downloading"));
|
|
|
|
|
|
|
+ emit_status("正在下载...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
|
// 下载并安装 .deb 包
|
|
// 下载并安装 .deb 包
|
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
|
|
@@ -592,15 +593,16 @@ where
|
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
|
let current_percent = percent as i32;
|
|
let current_percent = percent as i32;
|
|
|
- let should_log = current_percent - last_logged_percent >= 5;
|
|
|
|
|
|
|
+ // 每 10% 记录一次日志
|
|
|
|
|
+ let should_log = current_percent - last_logged_percent >= 10;
|
|
|
if should_log {
|
|
if should_log {
|
|
|
- last_logged_percent = (current_percent / 5) * 5;
|
|
|
|
|
|
|
+ last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
- let message = format!("Downloading VS Code... ({:.1}MB / {:.1}MB)", downloaded_mb, total_mb);
|
|
|
|
|
- emit_status(&message, progress, Some("install.downloading.progress"));
|
|
|
|
|
|
|
+ let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
- emit_status("Installing VS Code...", 65.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("安装中...", 65.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
|
let cmd = format!("sudo dpkg -i {}", deb_path.to_str().unwrap());
|
|
let cmd = format!("sudo dpkg -i {}", deb_path.to_str().unwrap());
|
|
@@ -610,7 +612,7 @@ where
|
|
|
let _ = std::fs::remove_file(&deb_path);
|
|
let _ = std::fs::remove_file(&deb_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("VS Code installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "VS Code installed successfully".to_string(),
|
|
message: "VS Code installed successfully".to_string(),
|
|
@@ -631,10 +633,10 @@ async fn install_git<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("Preparing to install Git...", 0.0, Some("install.preparing"));
|
|
|
|
|
|
|
+ emit_status("正在准备安装...", 0.0, Some("install.preparing"), false);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -646,7 +648,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Downloading Git...", 10.0, Some("install.downloading"));
|
|
|
|
|
|
|
+ emit_status("正在下载...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
|
// 获取最新版本
|
|
// 获取最新版本
|
|
|
let client = reqwest::Client::new();
|
|
let client = reqwest::Client::new();
|
|
@@ -685,16 +687,16 @@ where
|
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
let downloaded_mb = downloaded as f64 / 1024.0 / 1024.0;
|
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
let total_mb = total as f64 / 1024.0 / 1024.0;
|
|
|
let current_percent = percent as i32;
|
|
let current_percent = percent as i32;
|
|
|
- // 每 5% 记录一次日志
|
|
|
|
|
- let should_log = current_percent - last_logged_percent >= 5;
|
|
|
|
|
|
|
+ // 每 10% 记录一次日志
|
|
|
|
|
+ let should_log = current_percent - last_logged_percent >= 10;
|
|
|
if should_log {
|
|
if should_log {
|
|
|
- last_logged_percent = (current_percent / 5) * 5;
|
|
|
|
|
|
|
+ last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
- let message = format!("Downloading Git... ({:.1}MB / {:.1}MB)", downloaded_mb, total_mb);
|
|
|
|
|
- emit_status(&message, progress, Some("install.downloading.progress"));
|
|
|
|
|
|
|
+ let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
- emit_status("Installing Git...", 65.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("安装中...", 65.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART"];
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART"];
|
|
|
|
|
|
|
@@ -709,7 +711,7 @@ where
|
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("Git installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Git installed successfully".to_string(),
|
|
message: "Git installed successfully".to_string(),
|
|
@@ -722,14 +724,14 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Git via Homebrew...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("Installing Git via Homebrew...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let output = run_shell_hidden("brew install git")
|
|
let output = run_shell_hidden("brew install git")
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("Git installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Git installed successfully".to_string(),
|
|
message: "Git installed successfully".to_string(),
|
|
@@ -742,14 +744,14 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Git...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("Installing Git...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
|
let output = run_shell_hidden("sudo apt-get install -y git")
|
|
let output = run_shell_hidden("sudo apt-get install -y git")
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("Git installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Git installed successfully".to_string(),
|
|
message: "Git installed successfully".to_string(),
|
|
@@ -769,10 +771,10 @@ async fn install_claude_code_software<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Claude Code...", 10.0, Some("install.installing"));
|
|
|
|
|
|
|
+ emit_status("安装中...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -787,7 +789,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("Claude Code installed successfully", 100.0, Some("install.success"));
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Claude Code installed successfully".to_string(),
|
|
message: "Claude Code installed successfully".to_string(),
|
|
@@ -807,7 +809,7 @@ async fn install_all<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>) + Copy,
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool) + Copy,
|
|
|
C: Fn() -> bool + Copy,
|
|
C: Fn() -> bool + Copy,
|
|
|
{
|
|
{
|
|
|
let mut results = Vec::new();
|
|
let mut results = Vec::new();
|