Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Sep 10, 2023
1 parent daa14a9 commit 639f2ce
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 57 deletions.
84 changes: 35 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ctrlc = { version = "3.4.1", features = ["termination"] }
dirs = "5.0.1"
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.106"
inquire = { version = "0.2.1" }
inquire = "0.6.2"
eyre = "0.6.8"
path-absolutize = "3.1.1"
which = "4.4.2"
Expand Down
18 changes: 11 additions & 7 deletions src/vscode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ use std::path::Path;
use std::process::Command as ChildProcess;
use which::which;

#[cfg(target_os = "macos")]
static DEFAULT_CODE_PATH: &str =
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code";
#[cfg(target_os = "linux")]
static DEFAULT_CODE_PATH: &str = "/usr/share/code/bin/code";
#[cfg(target_os = "freebsd")]
static DEFAULT_CODE_PATH: &str = "/usr/share/code/bin/code";
#[cfg(target_os = "windows")]
static DEFAULT_CODE_PATH: &str = "C:\\Program Files\\Microsoft VS Code";

// Open a path in file explorer
pub fn open(folder: &Path) -> Result<(), Report> {
let open_command = match which("code") {
Ok(p) => Ok(p),
Err(_) => {
// Try to find VS Code in the default install location
#[cfg(target_os = "macos")]
let p =
Path::new("/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code");
#[cfg(target_os = "linux")]
let p = Path::new("/usr/share/code/bin/code");
#[cfg(target_os = "windows")]
let p = Path::new("C:\\Program Files\\Microsoft VS Code");
let p = Path::new(DEFAULT_CODE_PATH);

if p.exists() {
Ok(p.to_path_buf())
Expand Down

0 comments on commit 639f2ce

Please sign in to comment.