Skip to content

Commit

Permalink
Always use .msi on windows, even when in msys environment
Browse files Browse the repository at this point in the history
Emit both shell and bat proxies on all platforms

Fixes #3
Fixes #4
  • Loading branch information
Diggsey committed Oct 8, 2015
1 parent 3852358 commit 483367b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 1 addition & 3 deletions rust-install/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ pub fn get_host_triple() -> (&'static str, Option<&'static str>, Option<&'static

pub fn get_installer_ext() -> &'static str {
if cfg!(windows) {
if env::var_os("MSYSTEM").and_then(utils::if_not_empty).is_none() {
return ".msi"
}
return ".msi"
}
".tar.gz"
}
Expand Down
11 changes: 5 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,12 @@ fn install(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
}

fn handle_install(cfg: &Cfg, should_move: bool, add_to_path: bool) -> Result<()> {
#[cfg(windows)]
fn create_proxy_script(mut path: PathBuf, name: &'static str) -> Result<()> {
fn create_bat_proxy(mut path: PathBuf, name: &'static str) -> Result<()> {
path.push(name.to_owned() + ".bat");
utils::write_file(name, &path, &format!("@\"%~dp0\\multirust\" run {} %*", name))
}
#[cfg(not(windows))]
fn create_proxy_script(mut path: PathBuf, name: &'static str) -> Result<()> {
path.push(name.to_owned() + ".sh");
fn create_sh_proxy(mut path: PathBuf, name: &'static str) -> Result<()> {
path.push(name.to_owned());
utils::write_file(name, &path, &format!("#!/bin/sh\n\"`dirname $0`/multirust\" run {} \"$@\"", name))
}

Expand All @@ -291,7 +289,8 @@ fn handle_install(cfg: &Cfg, should_move: bool, add_to_path: bool) -> Result<()>

let tools = ["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb"];
for tool in &tools {
try!(create_proxy_script(bin_path.clone(), tool));
try!(create_bat_proxy(bin_path.clone(), tool));
try!(create_sh_proxy(bin_path.clone(), tool));
}

#[cfg(windows)]
Expand Down

0 comments on commit 483367b

Please sign in to comment.