Skip to content

Commit

Permalink
.profile and if zsh .zprofile
Browse files Browse the repository at this point in the history
  • Loading branch information
polonez committed Mar 27, 2017
1 parent aa3c0b0 commit 073e6e7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/rustup-cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,16 +978,20 @@ fn get_add_path_methods() -> Vec<PathUpdateMethod> {
return vec![PathUpdateMethod::Windows];
}

let mut profile_name = ".profile";
let profile_name = ".profile";

let profile = utils::home_dir().map(|p| p.join(profile_name));
let mut profiles = vec![profile];

if let Ok(shell) = env::var("SHELL") {
if shell.contains("zsh") {
profile_name = ".zprofile";
let zprofile_name = ".zprofile";
let zprofile = utils::home_dir().map(|p| p.join(zprofile_name));
profiles.push(zprofile);
}
}

let profile = utils::home_dir().map(|p| p.join(profile_name));
let rcfiles = vec![profile].into_iter().filter_map(|f|f);

let rcfiles = profiles.into_iter().filter_map(|f|f);
rcfiles.map(PathUpdateMethod::RcFile).collect()
}

Expand Down

0 comments on commit 073e6e7

Please sign in to comment.