/** * Extracts all installed plugin directories from the provided {@code rootPath}. * * @param rootPath the path where the plugins are installed * @return a list of all plugin paths installed in the {@code rootPath} * @throws IOException if an I/O exception occurred reading the directories */ public static List<Path> findPluginDirs(final Path rootPath) throws IOException { final List<Path> plugins = new ArrayList<>(); final Set<String> seen = new HashSet<>(); if (Files.exists(rootPath)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(rootPath)) { for (Path plugin : stream) { if (FileSystemUtils.isDesktopServicesStore(plugin) || plugin.getFileName().toString().startsWith(".removing-")) { continue; } if (seen.add(plugin.getFileName().toString()) == false) { throw new IllegalStateException("duplicate plugin: " + plugin); } plugins.add(plugin); } } } return plugins; }
/** * Extracts all installed plugin directories from the provided {@code rootPath}. * * @param rootPath the path where the plugins are installed * @return a list of all plugin paths installed in the {@code rootPath} * @throws IOException if an I/O exception occurred reading the directories */ public static List<Path> findPluginDirs(final Path rootPath) throws IOException { final List<Path> plugins = new ArrayList<>(); final Set<String> seen = new HashSet<>(); if (Files.exists(rootPath)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(rootPath)) { for (Path plugin : stream) { if (FileSystemUtils.isDesktopServicesStore(plugin) || plugin.getFileName().toString().startsWith(".removing-")) { continue; } if (seen.add(plugin.getFileName().toString()) == false) { throw new IllegalStateException("duplicate plugin: " + plugin); } plugins.add(plugin); } } } return plugins; }
/** * Extracts all installed plugin directories from the provided {@code rootPath}. * * @param rootPath the path where the plugins are installed * @return a list of all plugin paths installed in the {@code rootPath} * @throws IOException if an I/O exception occurred reading the directories */ public static List<Path> findPluginDirs(final Path rootPath) throws IOException { final List<Path> plugins = new ArrayList<>(); final Set<String> seen = new HashSet<>(); if (Files.exists(rootPath)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(rootPath)) { for (Path plugin : stream) { if (FileSystemUtils.isDesktopServicesStore(plugin) || plugin.getFileName().toString().startsWith(".removing-")) { continue; } if (seen.add(plugin.getFileName().toString()) == false) { throw new IllegalStateException("duplicate plugin: " + plugin); } plugins.add(plugin); } } } return plugins; }