diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-03-07 18:50:01 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-07 08:20:01 -0500 |
commit | 74584eef04a0a395d903ec9fcb8d91caf305be41 (patch) | |
tree | 8799cd4fd7f80108c3b9194908a3e46ec5283c48 /cli/tools | |
parent | 2894c0e615bf99e86f80ab1d2c7278be9769a52b (diff) |
fix(cli/compile): do not append .exe depending on target (#9668)
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/standalone.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs index 884d2a31d..062b80732 100644 --- a/cli/tools/standalone.rs +++ b/cli/tools/standalone.rs @@ -129,14 +129,25 @@ pub fn create_standalone_binary( /// is not already standalone binary it will return error instead. pub async fn write_standalone_binary( output: PathBuf, + target: Option<String>, final_bin: Vec<u8>, ) -> Result<(), AnyError> { - let output = - if cfg!(windows) && output.extension().unwrap_or_default() != "exe" { - PathBuf::from(output.display().to_string() + ".exe") - } else { - output - }; + let output = match target { + Some(target) => { + if target.contains("windows") { + PathBuf::from(output.display().to_string() + ".exe") + } else { + output + } + } + None => { + if cfg!(windows) && output.extension().unwrap_or_default() != "exe" { + PathBuf::from(output.display().to_string() + ".exe") + } else { + output + } + } + }; if output.exists() { // If the output is a directory, throw error |