Prechádzať zdrojové kódy

文件夹选择窗口

黄中银 2 týždňov pred
rodič
commit
f7b1bb684f
1 zmenil súbory, kde vykonal 4 pridanie a 0 odobranie
  1. 4 0
      src-tauri/src/commands/window.rs

+ 4 - 0
src-tauri/src/commands/window.rs

@@ -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 {
 pub async fn select_directory(default_path: Option<String>) -> DirectoryResult {
     #[cfg(target_os = "windows")]
     #[cfg(target_os = "windows")]
     {
     {
+        use std::os::windows::process::CommandExt;
         use std::process::{Command, Stdio};
         use std::process::{Command, Stdio};
 
 
+        const CREATE_NO_WINDOW: u32 = 0x08000000;
+
         // 处理默认路径:如果路径存在则使用,否则使用空字符串
         // 处理默认路径:如果路径存在则使用,否则使用空字符串
         let initial_path = default_path
         let initial_path = default_path
             .filter(|p| !p.is_empty() && std::path::Path::new(p).exists())
             .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])
             .args(["-NoProfile", "-Command", &script])
             .stdout(Stdio::piped())
             .stdout(Stdio::piped())
             .stderr(Stdio::piped())
             .stderr(Stdio::piped())
+            .creation_flags(CREATE_NO_WINDOW)
             .output();
             .output();
 
 
         match output {
         match output {