Skip to content

Commit

Permalink
adjust installer to remove the file before copying the new one in
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwparas committed Nov 8, 2024
1 parent 36962a3 commit 4da4151
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions crates/cargo-steel-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,10 @@ pub fn run() -> Result<(), Box<dyn Error>> {

println!("Copying {} to {}", file, &steel_home.to_str().unwrap());

std::fs::copy(file, &steel_home).unwrap();

steel_home.pop();
break;
}
}
} else if last
.target
.kind
.iter()
.find(|x| x.as_str() == "dylib")
.is_some()
{
for file in last.filenames {
if matches!(file.extension(), Some("so") | Some("dylib") | Some("lib")) {
println!("Found a dylib!");

let filename = file.file_name().unwrap();

steel_home.push(filename);

println!("Copying {} to {}", file, &steel_home.to_str().unwrap());
if steel_home.exists() {
std::fs::remove_file(&steel_home)
.expect("Unable to delete the existing dylib");
}

std::fs::copy(file, &steel_home).unwrap();

Expand Down

0 comments on commit 4da4151

Please sign in to comment.