Bugfix crash unauthorized delete

This commit is contained in:
Alessandro Proto 2023-04-11 13:26:18 +02:00
parent b09ab4bdff
commit fa39689e3a

View file

@ -426,6 +426,8 @@ public class FileSystem : IComponent
L.Error("path not found"); L.Error("path not found");
} }
try
{
var attr = File.GetAttributes(path); var attr = File.GetAttributes(path);
if (attr.HasFlag(FileAttributes.Directory)) if (attr.HasFlag(FileAttributes.Directory))
{ {
@ -440,6 +442,11 @@ public class FileSystem : IComponent
{ {
File.Delete(path); File.Delete(path);
} }
}
catch (Exception e)
{
return L.Error(e.Message);
}
return 0; return 0;
} }