mirror of
https://github.com/CrazyJasonwell/clash-verge-rev.git
synced 2026-10-21 10:48:42 +08:00
refactor: optimize
This commit is contained in:
1 parent
04f4934adb
commit
2d00ddad2b
20 files changed
+812
-631
No files matched your search
@@ -58,22 +58,20 @@ pub fn open_file(path: PathBuf) -> Result<()> {
|
||||
.arg(path)
|
||||
.spawn()
|
||||
{
|
||||
bail!(format!("failed to open file by VScode for `{err}`"));
|
||||
bail!("failed to open file by VScode for `{err}`");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if let Err(err) = Command::new(code).arg(path).spawn() {
|
||||
bail!(format!("failed to open file by VScode for `{err}`"));
|
||||
bail!("failed to open file by VScode for `{err}`");
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
match open::that(path) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => bail!(format!("failed to open file for `{err}`")),
|
||||
}
|
||||
open::that(path)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
|
||||
Reference in new issue
Block a user