Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PATH in post-install message when not modifying PATH #1126

Merged
merged 5 commits into from
May 23, 2017
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
23 changes: 14 additions & 9 deletions src/rustup-cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
"
Expand All @@ -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`
Expand All @@ -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.
"
};
Expand Down Expand Up @@ -204,7 +204,11 @@ fn canonical_cargo_home() -> Result<String> {

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"%USERPROFILE%\.cargo");
}
}

Ok(path_str)
Expand Down Expand Up @@ -288,21 +292,22 @@ 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 {
format!(post_install_msg_win!())
format!(post_install_msg_win!(),
cargo_home = cargo_home)
}
} else {
if cfg!(unix) {
let cargo_home = try!(canonical_cargo_home());
format!(post_install_msg_unix_no_modify_path!(),
cargo_home = cargo_home)
} else {
format!(post_install_msg_win_no_modify_path!())
format!(post_install_msg_win_no_modify_path!(),
cargo_home = cargo_home)
}
};
term2::stdout().md(msg);
Expand Down