Skip to content

Commit

Permalink
pallet-revive-fixtures: Try not to re-create fixture dir (paritytech#…
Browse files Browse the repository at this point in the history
…6735)

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
2 people authored and Krayt78 committed Dec 18, 2024
1 parent 142be64 commit dd55edc
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 dd55edc

Please sign in to comment.