Skip to content

Commit 0b69c1d

Browse files
committed
fix: edge case where theres an empty directory
1 parent 833cbe8 commit 0b69c1d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/wasm/src/util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ pub fn delete_folder_recursively(path: &Path, batch_size: Option<usize>) -> io::
3030
delete_folder_recursively(&path, batch_size)?;
3131
} else if path_type == PathType::File {
3232
fs::remove_file(&path)?;
33+
} else if let None = path.extension() { // There are edge cases where completely empty directories are created and can't be deleted. They get registered as "unknown" path type so we need to check if the path has an extension (which would tell us if it's a file or a directory), and if it doesn't, we delete it as a directory
34+
let _ = fs::remove_dir(&path); // this can fail silently, but we don't care since there also might be cases where a file literally doesn't exist
3335
}
3436
}
3537
// Check if the directory is empty. If it is, delete it

0 commit comments

Comments
 (0)