Skip to content

Commit

Permalink
fix: fix profile is not up to date and denobin will not be injected w… (
Browse files Browse the repository at this point in the history
#113)

* fix: fix profile is not up to date and denobin will not be injected when present before

* should be good now

* makes clippy happy :)
  • Loading branch information
CGQAQ authored Jun 12, 2022
1 parent 1e8879f commit 8cd4ce7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
36 changes: 22 additions & 14 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ serde_json = "1.0.81"
dirs = "4.0.0"
phf = { version = "0.10.1", features = ["macros"] }
colored = "2.0.0"
set_env = "1.3.1"
native-tls = { version = "0.2.10", features = ["vendored"] }
set_env = "1.3.4"
which = "4.2.5"

[target.'cfg(windows)'.dependencies]
output_vt100 = "0.1.3"
Expand Down
11 changes: 10 additions & 1 deletion src/commands/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ pub fn exec(meta: &mut DvmMeta) -> Result<()> {
set_env::check_or_set("DVM_DIR", home_path.to_str().unwrap()).unwrap();
let path = set_env::get("PATH").unwrap();
let looking_for = deno_bin_path().parent().unwrap().to_str().unwrap().to_string();
if !path.contains(looking_for.as_str()) {
let current = which::which("deno");

if let Ok(current) = current {
if current.to_str().unwrap().starts_with(&looking_for) {
println!("{}", "DVM deno bin is already set correctly.".green());
} else {
set_env::prepend("PATH", looking_for.as_str()).unwrap();
println!("{}", "Please restart your shell of choice to take effects.".red());
}
} else if !path.contains(looking_for.as_str()) {
set_env::prepend("PATH", looking_for.as_str()).unwrap();
println!("{}", "Please restart your shell of choice to take effects.".red());
}
Expand Down

0 comments on commit 8cd4ce7

Please sign in to comment.