Skip to content

Commit c4f57f3

Browse files
author
Stewart Miles
committed
Remove empty parent directories when an asset is cleaned up.
When deleting obsolete files on package upgrade delete all empty parent directories to clean up the project. Bug: 150886091 Change-Id: I67a69cd84dacdbd1579cadf3990f26c455e38e45
1 parent c3132e5 commit c4f57f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/VersionHandlerImpl/src/VersionHandlerImpl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ public static void UpdateVersionedAssets(bool forceUpdate, Action complete) {
24962496
cleanupFiles.Add(new KeyValuePair<string, string>(filename, filename));
24972497
}
24982498
} else {
2499-
foreach (var filename in obsoleteFiles.unreferenced) MoveAssetToTrash(filename);
2499+
FileUtils.RemoveAssets(obsoleteFiles.unreferenced, VersionHandlerImpl.Logger);
25002500
}
25012501
}
25022502

@@ -2514,7 +2514,7 @@ public static void UpdateVersionedAssets(bool forceUpdate, Action complete) {
25142514
String.Join(", ", references.ToArray()))));
25152515
}
25162516
} else {
2517-
foreach (var item in obsoleteFiles.referenced) MoveAssetToTrash(item.Key);
2517+
FileUtils.RemoveAssets(obsoleteFiles.referenced.Keys, VersionHandlerImpl.Logger);
25182518
}
25192519
}
25202520

@@ -2525,7 +2525,7 @@ public static void UpdateVersionedAssets(bool forceUpdate, Action complete) {
25252525
};
25262526
Action deleteFiles = () => {
25272527
bool deletedAll = true;
2528-
foreach (var filename in window.SelectedItems) MoveAssetToTrash(filename);
2528+
FileUtils.RemoveAssets(window.SelectedItems, VersionHandlerImpl.Logger);
25292529
foreach (var filenameAndDisplay in window.AvailableItems) {
25302530
if (!window.SelectedItems.Contains(filenameAndDisplay.Key)) {
25312531
deletedAll = false;

0 commit comments

Comments
 (0)