Skip to content

Commit

Permalink
load plugins from subdir in "Plugins" (HearthSim#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
epix37 committed Apr 28, 2015
1 parent 1d70f2a commit d97d43d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Hearthstone Deck Tracker/Plugins/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,23 @@ private static string PluginSettingsFile

public void LoadPlugins()
{
LoadPlugins(DefaultPath);
LoadPlugins(DefaultPath, true);
}

public void LoadPlugins(string pluginPath)
public void LoadPlugins(string pluginPath, bool checkSubDirs)
{
if(!Directory.Exists(pluginPath))
return;
if(Plugins.Any())
UnloadPlugins();
var files = Directory.GetFiles(pluginPath);
var dirInfo = new DirectoryInfo(pluginPath);

var files = dirInfo.GetFiles().Select(f => f.FullName).ToList();
if(checkSubDirs)
{
foreach(var dir in dirInfo.GetDirectories())
files.AddRange(dir.GetFiles().Select(f => f.FullName));
}

foreach(var file in files)
{
Expand Down

0 comments on commit d97d43d

Please sign in to comment.