Browse Source

Fix exception when deleting a non-empty directory (#20194)

pull/20199/head
Dawid Wąsowski 2 months ago
committed by GitHub
parent
commit
6e04c167f0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      src/Avalonia.Base/Platform/Storage/FileIO/BclStorageItem.cs

12
src/Avalonia.Base/Platform/Storage/FileIO/BclStorageItem.cs

@ -58,7 +58,17 @@ internal abstract class BclStorageItem(FileSystemInfo fileSystemInfo) : IStorage
_ => null
};
internal static void DeleteCore(FileSystemInfo fileSystemInfo) => fileSystemInfo.Delete();
internal static void DeleteCore(FileSystemInfo fileSystemInfo)
{
if (fileSystemInfo is DirectoryInfo directoryInfo)
{
directoryInfo.Delete(true);
}
else
{
fileSystemInfo.Delete();
}
}
internal static Uri GetPathCore(FileSystemInfo fileSystemInfo)
{

Loading…
Cancel
Save