diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2015-12-24 09:26:32 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2015-12-24 09:26:32 +0200 |
commit | 35ff0f5936242696df02d9a9f9b98eb3cca5de4c (patch) | |
tree | e722bf62bded3064908104cf16facbedc20ced68 /pf4j | |
parent | 730be40b1073bfd523be2669d1e2fec710e948d4 (diff) | |
download | pf4j-35ff0f5936242696df02d9a9f9b98eb3cca5de4c.tar.gz pf4j-35ff0f5936242696df02d9a9f9b98eb3cca5de4c.zip |
In development mode hide plugins/target (is not a plugin)
Diffstat (limited to 'pf4j')
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java index 03a0d48..74b8f18 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java @@ -23,7 +23,9 @@ import ro.fortsoft.pf4j.util.AndFileFilter; import ro.fortsoft.pf4j.util.DirectoryFileFilter; import ro.fortsoft.pf4j.util.FileUtils; import ro.fortsoft.pf4j.util.HiddenFilter; +import ro.fortsoft.pf4j.util.NameFileFilter; import ro.fortsoft.pf4j.util.NotFileFilter; +import ro.fortsoft.pf4j.util.OrFileFilter; import ro.fortsoft.pf4j.util.Unzip; import ro.fortsoft.pf4j.util.ZipFileFilter; @@ -380,10 +382,8 @@ public class DefaultPluginManager implements PluginManager { } // check for no plugins - List<FileFilter> filterList = new ArrayList<>(); - filterList.add(new DirectoryFileFilter()); - filterList.add(new NotFileFilter(createHiddenPluginFilter())); - FileFilter pluginsFilter = new AndFileFilter(filterList); + AndFileFilter pluginsFilter = new AndFileFilter(new DirectoryFileFilter()); + pluginsFilter.addFileFilter(new NotFileFilter(createHiddenPluginFilter())); File[] directories = pluginsDirectory.listFiles(pluginsFilter); if (directories == null) { directories = new File[0]; @@ -682,7 +682,13 @@ public class DefaultPluginManager implements PluginManager { } protected FileFilter createHiddenPluginFilter() { - return new HiddenFilter(); + OrFileFilter hiddenPluginFilter = new OrFileFilter(new HiddenFilter()); + + if (RuntimeMode.DEVELOPMENT.equals(getRuntimeMode())) { + hiddenPluginFilter.addFileFilter(new NameFileFilter("target")); + } + + return hiddenPluginFilter; } /** |