From 02f9561a88f31b62535362cf9cb887608c87e34c Mon Sep 17 00:00:00 2001 From: Fabio B Date: Thu, 18 May 2017 21:34:54 +0200 Subject: [PATCH 1/5] Add PATH in post-install message when not modifying PATH --- src/rustup-cli/self_update.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 7d1a641c5a..cdbd57bb15 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -136,7 +136,7 @@ macro_rules! post_install_msg_unix_no_modify_path { () => { r"# Rust is installed now. Great! -To get started you need Cargo's bin directory in your `PATH` +To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` environment variable. To configure your current shell run `source {cargo_home}/env` @@ -148,7 +148,7 @@ macro_rules! post_install_msg_win_no_modify_path { () => { r"# Rust is installed now. Great! -To get started you need Cargo's bin directory in your `PATH` +To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` environment variable. This has not been done automatically. " }; @@ -302,7 +302,9 @@ pub fn install(no_prompt: bool, verbose: bool, format!(post_install_msg_unix_no_modify_path!(), cargo_home = cargo_home) } else { - format!(post_install_msg_win_no_modify_path!()) + let cargo_home = try!(utils::cargo_home()); + format!(post_install_msg_win_no_modify_path!(), + cargo_home = cargo_home.display()) } }; term2::stdout().md(msg); From 5fd9c9c20582def028d6ad6746c7afcf91de6594 Mon Sep 17 00:00:00 2001 From: Fabio B Date: Thu, 18 May 2017 23:14:57 +0200 Subject: [PATCH 2/5] Change slash to backslash in win PATH --- src/rustup-cli/self_update.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index cdbd57bb15..31cc2f49e0 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -148,7 +148,7 @@ macro_rules! post_install_msg_win_no_modify_path { () => { r"# Rust is installed now. Great! -To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` +To get started you need Cargo's bin directory ({cargo_home_bin}) in your `PATH` environment variable. This has not been done automatically. " }; @@ -303,8 +303,9 @@ pub fn install(no_prompt: bool, verbose: bool, cargo_home = cargo_home) } else { let cargo_home = try!(utils::cargo_home()); + let cargo_home_bin = cargo_home.join("bin"); format!(post_install_msg_win_no_modify_path!(), - cargo_home = cargo_home.display()) + cargo_home_bin = cargo_home_bin.display()) } }; term2::stdout().md(msg); From ce1692739452ad08f751870524a5d98f8fee88c6 Mon Sep 17 00:00:00 2001 From: Fabio B Date: Mon, 22 May 2017 20:53:51 +0200 Subject: [PATCH 3/5] Switch to using canonical_cargo_home() on Windows --- src/rustup-cli/self_update.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 31cc2f49e0..220e26022c 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -148,7 +148,7 @@ macro_rules! post_install_msg_win_no_modify_path { () => { r"# Rust is installed now. Great! -To get started you need Cargo's bin directory ({cargo_home_bin}) in your `PATH` +To get started you need Cargo's bin directory ({cargo_home}\bin) in your `PATH` environment variable. This has not been done automatically. " }; @@ -204,7 +204,11 @@ fn canonical_cargo_home() -> Result { let default_cargo_home = utils::home_dir().unwrap_or(PathBuf::from(".")).join(".cargo"); if default_cargo_home == path { - path_str = String::from("$HOME/.cargo"); + if cfg!(unix) { + path_str = String::from("$HOME/.cargo"); + } else { + path_str = String::from(r"%HOMEPATH%\.cargo"); + } } Ok(path_str) @@ -288,9 +292,9 @@ pub fn install(no_prompt: bool, verbose: bool, // More helpful advice, skip if -y if !no_prompt { + let cargo_home = try!(canonical_cargo_home()); let msg = if !opts.no_modify_path { if cfg!(unix) { - let cargo_home = try!(canonical_cargo_home()); format!(post_install_msg_unix!(), cargo_home = cargo_home) } else { @@ -298,14 +302,11 @@ pub fn install(no_prompt: bool, verbose: bool, } } else { if cfg!(unix) { - let cargo_home = try!(canonical_cargo_home()); format!(post_install_msg_unix_no_modify_path!(), cargo_home = cargo_home) } else { - let cargo_home = try!(utils::cargo_home()); - let cargo_home_bin = cargo_home.join("bin"); format!(post_install_msg_win_no_modify_path!(), - cargo_home_bin = cargo_home_bin.display()) + cargo_home = cargo_home) } }; term2::stdout().md(msg); From de6727146c62d23633a0c331e43b679e1153be79 Mon Sep 17 00:00:00 2001 From: Fabio B Date: Mon, 22 May 2017 21:14:12 +0200 Subject: [PATCH 4/5] Add cargo bin path to post_install_msg_win and post_install_msg_unix --- src/rustup-cli/self_update.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 220e26022c..3f1e8bb658 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -112,7 +112,7 @@ macro_rules! post_install_msg_unix { () => { r"# Rust is installed now. Great! -To get started you need Cargo's bin directory in your `PATH` +To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` environment variable. Next time you log in this will be done automatically. @@ -125,7 +125,7 @@ macro_rules! post_install_msg_win { () => { r"# Rust is installed now. Great! -To get started you need Cargo's bin directory in your `PATH` +To get started you need Cargo's bin directory ({cargo_home}\bin) in your `PATH` environment variable. Future applications will automatically have the correct environment, but you may need to restart your current shell. " @@ -298,7 +298,8 @@ pub fn install(no_prompt: bool, verbose: bool, format!(post_install_msg_unix!(), cargo_home = cargo_home) } else { - format!(post_install_msg_win!()) + format!(post_install_msg_win!(), + cargo_home = cargo_home) } } else { if cfg!(unix) { From a2e465cb6ce8fae78e006492d56a3e56487d4a25 Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Tue, 23 May 2017 14:25:01 +0100 Subject: [PATCH 5/5] Use `USERPROFILE` instead of `HOMEPATH` --- src/rustup-cli/self_update.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 3f1e8bb658..6a0b8a7926 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -207,7 +207,7 @@ fn canonical_cargo_home() -> Result { if cfg!(unix) { path_str = String::from("$HOME/.cargo"); } else { - path_str = String::from(r"%HOMEPATH%\.cargo"); + path_str = String::from(r"%USERPROFILE%\.cargo"); } }