diff --git a/crates/moonbuild/src/gen/gen_build.rs b/crates/moonbuild/src/gen/gen_build.rs index d6322842..11c92e15 100644 --- a/crates/moonbuild/src/gen/gen_build.rs +++ b/crates/moonbuild/src/gen/gen_build.rs @@ -505,6 +505,12 @@ pub fn gen_n2_build_state( .to_string(); let bin_script_path = install_path.join(bin_script_name); + if bin_script_path.exists() && bin_script_path.is_dir() { + anyhow::bail!( + "bin install failed, there is a directory {:?} already exists", + bin_script_path + ); + } if !bin_script_path.exists() { let artifact_output_path = PathBuf::from(&item.out) diff --git a/crates/moonbuild/src/pre_build.rs b/crates/moonbuild/src/pre_build.rs index d5f3b4b8..eb12895a 100644 --- a/crates/moonbuild/src/pre_build.rs +++ b/crates/moonbuild/src/pre_build.rs @@ -126,8 +126,8 @@ pub fn load_moon_pre_build( .source_dir .join(maybe_ps1) .with_extension("ps1"); - let ps1_path = dunce::canonicalize(ps1_path).unwrap(); if ps1_path.exists() { + let ps1_path = dunce::canonicalize(ps1_path).unwrap(); format!("powershell {}", ps1_path.display()) } else { command