Skip to content
This repository was archived by the owner on Mar 3, 2021. It is now read-only.

Warn if plugin loader paths don't exist #4

Open
wants to merge 2 commits into
base: reactor
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Impostor.Server/Plugins/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public static IHostBuilder UsePluginLoader(this IHostBuilder builder, PluginConf
// Add the plugins and libraries.
var pluginPaths = new List<string>(config.Paths);
var libraryPaths = new List<string>(config.LibraryPaths);
CheckPaths(pluginPaths);
CheckPaths(libraryPaths);

var rootFolder = Directory.GetCurrentDirectory();

Expand Down Expand Up @@ -120,6 +122,17 @@ public static IHostBuilder UsePluginLoader(this IHostBuilder builder, PluginConf
return builder;
}

private static void CheckPaths(IEnumerable<string> paths)
{
foreach (var path in paths)
{
if (!Directory.Exists(path))
{
Logger.Warning("Directory \"{path}\" was specified in the PluginLoader configuration, but this directory doesn't exist!", path);
}
}
}

private static void RegisterAssemblies(
IEnumerable<string> paths,
Matcher matcher,
Expand Down