From c9e13ad4125ac72d86591f81a413fc5086f8fb3c Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Thu, 19 May 2022 16:23:12 -0300 Subject: [PATCH] more io methods --- .../SharedSource/LuaCs/LuaCsUtility.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs index 84b9100b1..7591fca55 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs @@ -126,6 +126,22 @@ namespace Barotrauma File.WriteAllText(path, text); } + public static void Delete(string path) + { + if (!IsPathAllowedException(path)) + return; + + File.Delete(path); + } + + public static void DeleteDirectory(string path) + { + if (!IsPathAllowedException(path)) + return; + + Directory.Delete(path, true); + } + public static FileStream OpenRead(string path) { if (!IsPathAllowedException(path))