}
}
private static THashSet<String> collectFoldersToExclude(final Module module, final VirtualFile pubspecYamlFile) {
final THashSet<String> newExcludedPackagesUrls = new THashSet<String>();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
final VirtualFile root = pubspecYamlFile.getParent();
// java.io.File is used here because exclusion is done before FS refresh (in order not to trigger indexing of files that are going to be excluded)
final File pubFolder = new File(root.getPath() + "/.pub");
if (pubFolder.isDirectory() || ApplicationManager.getApplication().isUnitTestMode() && root.findChild(".pub") != null) {
newExcludedPackagesUrls.add(root.getUrl() + "/.pub");
}
final File buildFolder = new File(root.getPath() + "/build");
if (buildFolder.isDirectory() || ApplicationManager.getApplication().isUnitTestMode() && root.findChild("build") != null) {
newExcludedPackagesUrls.add(root.getUrl() + "/build");
}
final VirtualFile binFolder = root.findChild("bin");
if (binFolder != null && binFolder.isDirectory() && fileIndex.isInContent(binFolder)) {
newExcludedPackagesUrls.add(binFolder.getUrl() + "/packages");
}
appendPackagesFolders(newExcludedPackagesUrls, root.findChild("benchmark"), fileIndex);
appendPackagesFolders(newExcludedPackagesUrls, root.findChild("example"), fileIndex);