diff --git a/src/helpers.rs b/src/helpers.rs index d70df19b..26031bc8 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -3,6 +3,7 @@ use std::fs; use std::io; use std::ops; use std::path::{Path, PathBuf}; +use std::sync::Arc; use bytes::Bytes; use cargo_toml::Manifest; @@ -174,17 +175,17 @@ pub async fn download_tar_based_and_visit /// /// Return (install_path, is_custom_install_path) -pub fn get_install_path>(install_path: Option

) -> (Option, bool) { +pub fn get_install_path>(install_path: Option

) -> (Option>, bool) { // Command line override first first if let Some(p) = install_path { - return (Some(PathBuf::from(p.as_ref())), true); + return (Some(Arc::from(p.as_ref())), true); } // Environmental variables if let Ok(p) = std::env::var("CARGO_INSTALL_ROOT") { debug!("using CARGO_INSTALL_ROOT ({p})"); let b = PathBuf::from(p); - return (Some(b.join("bin")), true); + return (Some(Arc::from(b.join("bin"))), true); } if let Ok(p) = cargo_home() { @@ -199,7 +200,7 @@ pub fn get_install_path>(install_path: Option

) -> (Option Result<()> { // Compute install directory let (install_path, custom_install_path) = get_install_path(opts.install_path.as_deref()); - let install_path: Arc = Arc::from(install_path.ok_or_else(|| { + let install_path = install_path.ok_or_else(|| { error!("No viable install path found of specified, try `--install-path`"); miette!("No install path found or specified") - })?); + })?; debug!("Using install path: {}", install_path.display()); // Create a temporary directory for downloads etc.