From 073e6e7e4256e92b9f02b5da8182425456410852 Mon Sep 17 00:00:00 2001 From: polonez Date: Mon, 27 Mar 2017 16:55:53 +0900 Subject: [PATCH] .profile and if zsh .zprofile --- src/rustup-cli/self_update.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index a44c551902..cd06cfa839 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -978,16 +978,20 @@ fn get_add_path_methods() -> Vec { 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() }