Skip to content

Commit

Permalink
internal: add same name dir dectection for script bin
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Dec 11, 2024
1 parent 9a34488 commit 2ff9661
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions crates/moonbuild/src/gen/gen_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion crates/moonbuild/src/pre_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ff9661

Please sign in to comment.