private static async Task CompileEachFileAsync(string path, string searchPattern, string SaveFolder, SearchOption searchOption, Func<string, string, Task> doAsync)
{
// Avoid blocking the caller for the initial enumerate call.
await Task.Yield();
var sw = Stopwatch.StartNew();
// really need a simple exception swallowing filesystem walker, enumerations suck with exceptions !
foreach (string file in Directory.EnumerateFiles(path, searchPattern, searchOption))
{
await doAsync?.Invoke(file, SaveFolder);
}
if (Verbose > 0)
WriteLine($"processing time: {sw.Elapsed}");
}