|
|
@@ -65,8 +65,11 @@ pub async fn set_window_title(app: tauri::AppHandle, title: String) -> Result<()
|
|
|
pub async fn select_directory(default_path: Option<String>) -> DirectoryResult {
|
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
|
+ use std::os::windows::process::CommandExt;
|
|
|
use std::process::{Command, Stdio};
|
|
|
|
|
|
+ const CREATE_NO_WINDOW: u32 = 0x08000000;
|
|
|
+
|
|
|
// 处理默认路径:如果路径存在则使用,否则使用空字符串
|
|
|
let initial_path = default_path
|
|
|
.filter(|p| !p.is_empty() && std::path::Path::new(p).exists())
|
|
|
@@ -96,6 +99,7 @@ if ($dialog.DialogResult -eq [System.Windows.Forms.DialogResult]::OK) {{
|
|
|
.args(["-NoProfile", "-Command", &script])
|
|
|
.stdout(Stdio::piped())
|
|
|
.stderr(Stdio::piped())
|
|
|
+ .creation_flags(CREATE_NO_WINDOW)
|
|
|
.output();
|
|
|
|
|
|
match output {
|