From 483367b2ed047ee4ac4a86bf1c020a219795332b Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Thu, 8 Oct 2015 18:45:14 +0100 Subject: [PATCH] Always use .msi on windows, even when in msys environment Emit both shell and bat proxies on all platforms Fixes #3 Fixes #4 --- rust-install/src/dist.rs | 4 +--- src/main.rs | 11 +++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/rust-install/src/dist.rs b/rust-install/src/dist.rs index 9607c69265..7057eb8d6c 100644 --- a/rust-install/src/dist.rs +++ b/rust-install/src/dist.rs @@ -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" } diff --git a/src/main.rs b/src/main.rs index 967ca0331d..8d5167b733 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)) } @@ -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)]