mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
拆分代码4
This commit is contained in:
29
shell/Commands/FileSystem/RmdirCommand.cs
Normal file
29
shell/Commands/FileSystem/RmdirCommand.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace CMLeonOS.Commands.FileSystem
|
||||
{
|
||||
public static class RmdirCommand
|
||||
{
|
||||
public static void ProcessRmdir(CMLeonOS.FileSystem fileSystem, string args, bool fixMode, Action<string> showError)
|
||||
{
|
||||
if (string.IsNullOrEmpty(args))
|
||||
{
|
||||
showError("Please specify a directory name");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isInSysFolder = (args.Contains(@"\system\") || args.Contains(@"/sys/")) && !fixMode;
|
||||
|
||||
if (isInSysFolder)
|
||||
{
|
||||
showError("Cannot delete directories in sys folder");
|
||||
showError("Use fix mode to bypass this restriction");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileSystem.DeleteDirectory(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user