Browse Source

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

release/11.3.10
Dawid Wąsowski 2 months ago
committed by Julien Lebosquain
parent
commit
543ecbf417
No known key found for this signature in database GPG Key ID: 1833CAD10ACC46FD
  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