diff --git a/src/cli/build.rs b/src/cli/build.rs index 776cee2..dc35693 100644 --- a/src/cli/build.rs +++ b/src/cli/build.rs @@ -65,12 +65,19 @@ impl BuildCommand { self.base } else if let Some(target_inner) = self.target { - let target_exe_extension = get_target_exe_extension(target_inner.as_str()); + let target_exe_extension = match target_inner.as_str() { + "windows-x86_64" => "exe", + _ => "bin", + }; let path = TARGET_BASE_DIR.join(format!("lune-{}.{}", target_inner, target_exe_extension)); - output_path.set_extension(target_exe_extension); + output_path.set_extension(if target_exe_extension == "bin" { + "" + } else { + target_exe_extension + }); if !TARGET_BASE_DIR.exists() { fs::create_dir_all(TARGET_BASE_DIR.to_path_buf()).await?; @@ -184,10 +191,3 @@ async fn write_executable_file_to(path: impl AsRef, bytes: impl AsRef<[u8] Ok(()) } - -fn get_target_exe_extension(target: &str) -> &str { - match target { - "windows-x86_64" => "exe", - _ => "bin", - } -} diff --git a/src/standalone/metadata.rs b/src/standalone/metadata.rs index 01dc154..ad54b5d 100644 --- a/src/standalone/metadata.rs +++ b/src/standalone/metadata.rs @@ -49,7 +49,10 @@ impl Metadata { /** Creates a patched standalone binary from the given script contents. */ - pub async fn create_env_patched_bin(base_exe_path: Option, script_contents: impl Into>) -> Result> { + pub async fn create_env_patched_bin( + base_exe_path: Option, + script_contents: impl Into>, + ) -> Result> { let mut patched_bin = fs::read(base_exe_path.unwrap_or(CURRENT_EXE.to_path_buf())).await?; // Compile luau input into bytecode