Skip to content

Commit

Permalink
🚑 fs::remove_dir_all is not idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBardon committed Aug 8, 2024
1 parent 653b906 commit 7b40876
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/helpers/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,9 @@ pub fn trash_outdated_websites() -> Result<State, Error> {
// NOTE: This whould not be necessary since the directory should be deleted
// but there might be edge cases where it's still there and the next
// `fs::rename` will fail if it's the case.
fs::remove_dir_all(TRASH_DIR.as_path())?;
if TRASH_DIR.exists() {
fs::remove_dir_all(TRASH_DIR.as_path())?;
}

// Remove outdated websites
fs::rename(DEST_DIR.as_path(), TRASH_DIR.as_path())?;
Expand Down
2 changes: 1 addition & 1 deletion src/orangutan-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orangutan-server"
version = "0.4.8"
version = "0.4.9"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down

0 comments on commit 7b40876

Please sign in to comment.