public static List <LogInfo> DirDelete(EngineState s, CodeCommand cmd) { List <LogInfo> logs = new List <LogInfo>(); CodeInfo_DirDelete info = cmd.Info.Cast <CodeInfo_DirDelete>(); string dirPath = StringEscaper.Preprocess(s, info.DirPath); // Path Security Check if (!StringEscaper.PathSecurityCheck(dirPath, out string errorMsg)) { return(LogInfo.LogErrorMessage(logs, errorMsg)); } // Delete Directory FileHelper.DirDeleteEx(dirPath); logs.Add(new LogInfo(LogState.Success, $"Deleted directory [{dirPath}]")); return(logs); }
public static List <LogInfo> DirDelete(EngineState s, CodeCommand cmd) { List <LogInfo> logs = new List <LogInfo>(); Debug.Assert(cmd.Info.GetType() == typeof(CodeInfo_DirDelete)); CodeInfo_DirDelete info = cmd.Info as CodeInfo_DirDelete; string dirPath = StringEscaper.Preprocess(s, info.DirPath); // Path Security Check if (StringEscaper.PathSecurityCheck(dirPath, out string errorMsg) == false) { logs.Add(new LogInfo(LogState.Error, errorMsg)); return(logs); } // Delete Directory FileHelper.DirectoryDeleteEx(dirPath); logs.Add(new LogInfo(LogState.Success, $"Deleted directory [{dirPath}]")); return(logs); }