From eea9cb7c5b3684e04c3931409215e83d682f1733 Mon Sep 17 00:00:00 2001 From: GyDi <segydi@foxmail.com> Date: Fri, 28 Oct 2022 01:26:45 +0800 Subject: [PATCH] fix: open file --- src-tauri/src/utils/help.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/utils/help.rs b/src-tauri/src/utils/help.rs index 844ee71..b38ed90 100644 --- a/src-tauri/src/utils/help.rs +++ b/src-tauri/src/utils/help.rs @@ -50,9 +50,13 @@ pub fn open_file(path: PathBuf) -> Result<()> { #[cfg(target_os = "windows")] { use std::os::windows::process::CommandExt; - command = command.creation_flags(0x08000000); + if let Err(err) = command.creation_flags(0x08000000).arg(&path).spawn() { + log::error!(target: "app", "failed to open with VScode `{err}`"); + open::that(path)?; + } } + #[cfg(not(target_os = "windows"))] if let Err(err) = command.arg(&path).spawn() { log::error!(target: "app", "failed to open with VScode `{err}`"); open::that(path)?; -- GitLab