Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when no config files found #5

Open
charliefoxtwo opened this issue Nov 13, 2023 · 0 comments
Open

Warn when no config files found #5

charliefoxtwo opened this issue Nov 13, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@charliefoxtwo
Copy link
Owner

It would be very helpful if we could warn log when no config files are located, perhaps including the directory being searched in the log message.

public static async Task<AircraftBiosConfiguration[]> AllConfigurations(string? aliasesFileName = null, ILogger<AircraftBiosConfiguration>? logger = null,
params string[] configLocations)
{
var allFiles = configLocations.SelectMany(GetAllJsonFilesBelowDirectory).ToList();
var aliasTasks = allFiles.Where(f => f.Name == aliasesFileName).Select(f => GetAliases(f, logger));
var aliasResults = await Task.WhenAll(aliasTasks);
var aliases = new Dictionary<string, HashSet<string>>();
foreach (var result in aliasResults)
{
foreach (var (key, value) in result)
{
aliases.Add(key, value);
}
}
var configTasks = configLocations
.SelectMany(GetAllJsonFilesBelowDirectory)
.Where(f => f.Name != aliasesFileName)
.Select(f => BuildFromConfiguration(f, aliases, logger));
return (await Task.WhenAll(configTasks)).Where(c => c != null).Select(c => c!).ToArray();
}

@charliefoxtwo charliefoxtwo added enhancement New feature or request good first issue Good for newcomers labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant