Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/command/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ mod os {
let home = volta_home()?;
let formatted_home = format_home(home.root());

// Don't update the user's shell config files if VOLTA_HOME and PATH already contain what we need.
let home_in_path = match env::var_os("PATH") {
Some(paths) => env::split_paths(&paths).find(|p| p == home.shim_dir()),
None => None,
};

if env::var_os("VOLTA_HOME").is_some() && home_in_path.is_some() {
debug!(
"Skipping dot-file modification as VOLTA_HOME is set, and included in the PATH."
);
return Ok(());
}

debug!("Searching for profiles to update");
let profiles = determine_profiles()?;

Expand Down