Skip to content

Commit

Permalink
pallet-revive-fixtures: Try not to re-create fixture dir (#6735)
Browse files Browse the repository at this point in the history
On some systems trying to re-create the output directory will lead to an
error.

Fixes paritytech/subxt#1876

---------

Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
athei and bkchr authored Dec 3, 2024
1 parent 76a292b commit c56a98b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions substrate/frame/revive/fixtures/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,15 @@ fn create_out_dir() -> Result<PathBuf> {
.join("pallet-revive-fixtures");

// clean up some leftover symlink from previous versions of this script
if out_dir.exists() && !out_dir.is_dir() {
let mut out_exists = out_dir.exists();
if out_exists && !out_dir.is_dir() {
fs::remove_file(&out_dir)?;
out_exists = false;
}

if !out_exists {
fs::create_dir(&out_dir).context("Failed to create output directory")?;
}
fs::create_dir_all(&out_dir).context("Failed to create output directory")?;

// write the location of the out dir so it can be found later
let mut file = fs::File::create(temp_dir.join("fixture_location.rs"))
Expand Down

0 comments on commit c56a98b

Please sign in to comment.