public static ListCandidates ( |
||
baseDirectory | The base directory to scan for entry points. | |
return | List |
public static List<Candidate> ListCandidates(DirectoryInfo baseDirectory)
{
var candidates = new List<Candidate>();
baseDirectory.Walk(fileAction: file =>
{
// Ignore uninstallers
if (file.Name.ContainsIgnoreCase("uninstall") || file.Name.ContainsIgnoreCase("unins0")) return;
var candidate = _candidateCreators.Select(x => x()).FirstOrDefault(x => x.Analyze(baseDirectory, file));
if (candidate != null) candidates.Add(candidate);
});
return candidates;
}
}
public void TestListCandidates() { Deploy(DotNetExeTest.Reference, xbit: false); Deploy(PythonScriptTest.Reference, xbit: true); Deploy(PosixScriptTest.Reference, xbit: true); Deploy(PosixBinaryTest.Reference32, xbit: true); var candidates = Detection.ListCandidates(Directory).ToList(); candidates.Should().BeEquivalentTo( DotNetExeTest.Reference, PythonScriptTest.Reference, PosixScriptTest.Reference, PosixBinaryTest.Reference32); }