Clean up
This commit is contained in:
@@ -7,15 +7,21 @@ public class RequiresPluginAttribute : Attribute
|
||||
{
|
||||
public void RequirePluginProject(string command)
|
||||
{
|
||||
var currentDirectoryInfo = new DirectoryInfo(Environment.CurrentDirectory);
|
||||
var matcher = new Matcher()
|
||||
.AddInclude("*.csproj")
|
||||
.Execute(new DirectoryInfoWrapper(new DirectoryInfo(Environment.CurrentDirectory)));
|
||||
.Execute(new DirectoryInfoWrapper(currentDirectoryInfo));
|
||||
|
||||
if (!matcher.HasMatches)
|
||||
throw new($"Command '{command}' must be run in a command plugin project.");
|
||||
|
||||
var csprojFileName = $"{Path.GetDirectoryName(Environment.CurrentDirectory)}.csproj";
|
||||
bool IsCsprojFile(FilePatternMatch file) => Path.GetFileNameWithoutExtension(file.Path).Equals(csprojFileName);
|
||||
var csprojFileName = $"{new DirectoryInfo(Environment.CurrentDirectory).Name}.csproj";
|
||||
|
||||
bool IsCsprojFile(FilePatternMatch file)
|
||||
{
|
||||
return Path.GetFileName(file.Path) == csprojFileName;
|
||||
}
|
||||
|
||||
var hasCsprojFile = matcher.Files.Any(IsCsprojFile);
|
||||
|
||||
if (!hasCsprojFile)
|
||||
|
||||
Reference in New Issue
Block a user