Skip to content

Commit bafb203

Browse files
authored
Fix cleaning empty processed directories getting permanently stuck. (#23984)
# Objective - Fix an obvious infinite loop. ## Solution - Change `path` variable so we keep "going up" instead of repeatedly deleting the same path. It's not clear what the actual effects may be, I just noticed this in the code but not an actual bug. I believe what would happen is the first delete would succeed, and then the second delete would error which would break the loop. This is clearly the wrong behavior though. ## Testing - None.
1 parent 8930a15 commit bafb203

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • crates/bevy_asset/src/processor

crates/bevy_asset/src/processor/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,13 +984,14 @@ impl AssetProcessor {
984984
.await;
985985
}
986986

987-
async fn clean_empty_processed_ancestor_folders(&self, source: &AssetSource, path: &Path) {
987+
async fn clean_empty_processed_ancestor_folders(&self, source: &AssetSource, mut path: &Path) {
988988
// As a safety precaution don't delete absolute paths to avoid deleting folders outside of the destination folder
989989
if path.is_absolute() {
990990
error!("Attempted to clean up ancestor folders of an absolute path. This is unsafe so the operation was skipped.");
991991
return;
992992
}
993993
while let Some(parent) = path.parent() {
994+
path = parent;
994995
if parent == Path::new("") {
995996
break;
996997
}

0 commit comments

Comments
 (0)