17 lines
450 B
C#
17 lines
450 B
C#
namespace MycroForge.CLI.Commands.Attributes;
|
|
|
|
public class RequiresFileAttribute : Attribute
|
|
{
|
|
public string FilePath { get; }
|
|
|
|
public RequiresFileAttribute(string filePath)
|
|
{
|
|
FilePath = filePath;
|
|
}
|
|
|
|
public void RequireFile(string command)
|
|
{
|
|
if (!File.Exists(Path.Join(Environment.CurrentDirectory, FilePath)))
|
|
throw new($"Command '{command}' requires file {FilePath}");
|
|
}
|
|
} |