Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/cli/src/automation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,13 @@ fn open_path_or_url(target: &str) -> Result<(), String> {
#[cfg(target_os = "macos")]
let mut cmd = std::process::Command::new("open");
#[cfg(target_os = "windows")]
let mut cmd = std::process::Command::new("explorer");
let mut cmd = {
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
let mut c = std::process::Command::new("explorer");
c.creation_flags(CREATE_NO_WINDOW);
c
};
#[cfg(target_os = "linux")]
let mut cmd = std::process::Command::new("xdg-open");

Expand Down
8 changes: 6 additions & 2 deletions apps/desktop-gpui/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,12 @@ pub fn reveal_in_folder(path: &Path) {
}
#[cfg(target_os = "windows")]
{
std::process::Command::new("explorer")
.arg(format!("/select,{}", path.display()))
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;

let mut cmd = std::process::Command::new("explorer");
cmd.creation_flags(CREATE_NO_WINDOW);
cmd.arg(format!("/select,{}", path.display()))
.spawn()
}
#[cfg(all(not(target_os = "macos"), not(target_os = "windows")))]
Expand Down
8 changes: 6 additions & 2 deletions apps/desktop/src-tauri/src/automation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,12 @@ fn reveal_path(path: &Path) -> Result<(), String> {

#[cfg(target_os = "windows")]
{
std::process::Command::new("explorer")
.args(["/select,", path_str])
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;

let mut cmd = std::process::Command::new("explorer");
cmd.creation_flags(CREATE_NO_WINDOW);
cmd.args(["/select,", path_str])
.spawn()
.map_err(|e| format!("Failed to reveal: {e}"))?;
}
Expand Down
5 changes: 5 additions & 0 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4604,13 +4604,18 @@ async fn open_file_path(_app: AppHandle, path: PathBuf) -> Result<(), String> {

#[cfg(target_os = "windows")]
{
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;

if is_dir {
Command::new("explorer")
.creation_flags(CREATE_NO_WINDOW)
.arg(path_str)
.spawn()
.map_err(|e| format!("Failed to open folder: {e}"))?;
} else {
Command::new("explorer")
.creation_flags(CREATE_NO_WINDOW)
.args(["/select,", path_str])
.spawn()
.map_err(|e| format!("Failed to open folder: {e}"))?;
Expand Down