From 17056b3269403417034d7554d18712a8a963f86d Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Wed, 1 Feb 2023 08:28:36 +0100 Subject: [PATCH] Fixed runtime crash on fs.delete deleting full directory not recursively --- Capy64/Runtime/Libraries/FileSystem.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Capy64/Runtime/Libraries/FileSystem.cs b/Capy64/Runtime/Libraries/FileSystem.cs index ed5c12f..143ef0c 100644 --- a/Capy64/Runtime/Libraries/FileSystem.cs +++ b/Capy64/Runtime/Libraries/FileSystem.cs @@ -414,6 +414,11 @@ public class FileSystem : IPlugin var attr = File.GetAttributes(path); if (attr.HasFlag(FileAttributes.Directory)) { + if(!recursive && Directory.GetFileSystemEntries(path).Any()) + { + L.Error("directory not empty"); + return 0; + } Directory.Delete(path, recursive); } else