Make the dependecy test useful by using the result in main

This commit is contained in:
Robert Morrison 2022-06-20 03:47:03 +01:00
parent c6a00c8c2b
commit de68526bc3
Signed by: robert
GPG Key ID: 73E012EB3F4EC696

View File

@ -94,25 +94,34 @@ class Program
Environment.Exit(1); Environment.Exit(1);
} }
List<string> Input_files = GetAllFiles(_inputDirectory); // Test for dependencies
Log.Information("Input File Count: {count}",Input_files.Count());
foreach (string item in Input_files)
{
Console.WriteLine(item);
}
List<string> MatchFiles = GetAllFilesMatching(".*r.*",_inputDirectory);
Log.Information("MatchFiles '.*r.*' File Count: {count}",MatchFiles.Count());
foreach (string item in MatchFiles)
{
Console.WriteLine(item);
}
List<string> deps = new List<string>{"pandoc"}; List<string> deps = new List<string>{"pandoc"};
var dep2 = CheckDeps(deps); var dep = CheckDeps(deps);
Log.Debug("CheckDeps result: {@dep}",dep2); Log.Debug("CheckDeps result: {@dep}",dep);
// Deal with the dependency test results
Dictionary<string,string> depsDict = new();
if (dep.Item2 is null)
{
Log.Debug("Ignoring dependency check as no dependencies listed");
}
else
{
depsDict = dep.Item2;
}
if (!dep.Item1)
{
foreach (var dependency in depsDict)
{
Log.Error("Dependency {dependency} Cannot be found\nPlease install it or check it is in your PATH",dependency.Key);
}
Log.CloseAndFlush();
Environment.Exit(1);
}
Log.CloseAndFlush();
return 0; return 0;
} }