Retrieve a list of the available P3 project names from a directory.

@param directory directory containing P3 files
@return list of project names
1654
public static final List<String> listProjectNames(File directory)
   {
      List<String> result = new ArrayList<String>();

      File[] files = directory.listFiles(new FilenameFilter()
      {
         @Override public boolean accept(File dir, String name)
         {
            return name.toUpperCase().endsWith("STR.P3");
         }
      });

      if (files != null)
      {
         for (File file : files)
         {
            String fileName = file.getName();
            String prefix = fileName.substring(0, fileName.length() - 6);
            result.add(prefix);
         }
      }

      Collections.sort(result);

      return result;
   }
586639
public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
		File file = new File(path);
		return getContentsInDirectoryTree(file, "*", false, true);
	}
471083
private ArrayList<String> getFiles(String dir, String subDir) {
    ArrayList<String> files = new ArrayList<>();
    String fullDir = subDir == null ? dir : dir + File.separator + subDir;
    File[] listOfFiles = (new File(fullDir)).listFiles();
    if (listOfFiles != null) {
      for (File file : listOfFiles) {
        String fullName = subDir == null ? file.getName() : subDir + File.separator + file.getName();
        if (file.isFile()) {
          files.add(fullName);
        } else if (file.isDirectory()) {
          files.addAll(getFiles(dir, fullName));
        }
      }
    }
    return files;
  }
1089647
public static String unpack(String directory) {
        File file = unpack(new File(directory));
        return file.getAbsolutePath();
    }
365498
private void findFiles(File directory) throws IOException, ClassNotFoundException {

        File[] files = directory.listFiles(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return name.endsWith(".class");
            }
        });

        if (files != null) {
            for (File file : files) {
                int current = currentDirectoryPath.length();
                String fileName = file.getCanonicalPath().substring(++current);
                String className = fileName.replace(File.separatorChar, '.').substring(0, fileName.length() - 6);
                tryClass(className);
            }
        }
    }
589161
public static List<File> listFile(File rootDir) {
		return Files.fileTreeTraverser().preOrderTraversal(rootDir).filter(Files.isFile()).toList();
	}
794972
protected static IJavaProject[] getProjectSearchOrder(String projectName) {

		ArrayList<String> projectNames= new ArrayList<>();
		projectNames.add(projectName);

		int nextProject= 0;
		while (nextProject < projectNames.size()) {
			String nextProjectName= projectNames.get(nextProject);
			IJavaProject jproject= getJavaProject(nextProjectName);

			if (jproject != null) {
				try {
					String[] childProjectNames= jproject.getRequiredProjectNames();
					for (int i= 0; i < childProjectNames.length; i++) {
						if (!projectNames.contains(childProjectNames[i])) {
							projectNames.add(childProjectNames[i]);
						}
					}
				} catch (JavaModelException e) {
					JavaPlugin.log(e);
				}
			}
			nextProject+= 1;
		}

		ArrayList<IJavaProject> result= new ArrayList<>();
		for (int i= 0, size= projectNames.size(); i < size; i++) {
			String name= projectNames.get(i);
			IJavaProject project= getJavaProject(name);
			if (project != null)
				result.add(project);
		}

		return result.toArray(new IJavaProject[result.size()]);
	}
497019
public static List<File> listDirectories( File root ) {

		List<File> result = new ArrayList<> ();
		File[] files = root.listFiles( new DirectoryFileFilter());
		if( files != null )
			result.addAll( Arrays.asList( files ));

		Collections.sort( result, new FileNameComparator());
		return result;
	}
38339
public java.util.List<WorkspaceDirectory> getDirectories() {
        if (directories == null) {
            directories = new com.amazonaws.internal.SdkInternalList<WorkspaceDirectory>();
        }
        return directories;
    }
396853
@NonNull
  public static File[] listAllFiles(File directory) {
    if (directory == null) {
      return new File[0];
    }
    File[] files = directory.listFiles();
    return files != null ? files : new File[0];
  }
566525
private File[] getFilesInDir(File dir) {
        return dir.listFiles(new FileFilter() {
            public boolean accept(File file) {
                return file.isFile() && !file.getName().equals(ATTEMPTS_JSON_FILE_NAME);
            }
        });
    }
825085
@Override
    public List<Project> findProjects() {
        List<Project> projectList;
        try {
            projectList = createProjects(ldapDao.getDirectChildren(DnFactory.projects()));
        } catch (NoSuchNodeException | MissingParentException e) {
            LOGGER.error("LDAP exception", e);
            throw new LdapRuntimeException(e);
        }
        return projectList;
    }
178104
public static File getProjectDirectory(final File currentDir)
	{
		final String projectPath = PathFinder.getAbsolutePath(currentDir, true);
		final File projectFile = new File(projectPath);
		return projectFile;
	}
565717
public static File[] listExtensions(String extensionDir) {
    File[] extensions = new File(extensionDir)
        .listFiles(file -> file.getPath().toLowerCase().endsWith(Constants.EXTENSION_JAR));
    if (extensions == null) {
      // Directory does not exist
      return EMPTY_EXTENSIONS_LIST;
    }
    return extensions;
  }
639660
private void listDirectory(File directory,
                               RelativeDirectory subdirectory,
                               Set<JavaFileObject.Kind> fileKinds,
                               boolean recurse,
                               ListBuffer<JavaFileObject> resultList) {
        File d = subdirectory.getFile(directory);
        if (!caseMapCheck(d, subdirectory))
            return;

        File[] files = d.listFiles();
        if (files == null)
            return;

        if (sortFiles != null)
            Arrays.sort(files, sortFiles);

        for (File f: files) {
            String fname = f.getName();
            if (f.isDirectory()) {
                if (recurse && SourceVersion.isIdentifier(fname)) {
                    listDirectory(directory,
                                  new RelativeDirectory(subdirectory, fname),
                                  fileKinds,
                                  recurse,
                                  resultList);
                }
            } else {
                if (isValidFile(fname, fileKinds)) {
                    JavaFileObject fe =
                        new RegularFileObject(this, fname, new File(d, fname));
                    resultList.append(fe);
                }
            }
        }
    }
875509
private static File[] loadXmlFiles(final File directory) {
		return directory.listFiles(new FileFilter() {

			@Override
			public boolean accept(File file) {
				return file.getName().endsWith(".xml");
			}

		});
	}
1358368
function getProjectName(dir) {
    return fs.readFileAsync(path.join(dir, 'package.json'))
        .then(JSON.parse & _.name)
        .catchThrow(new Error('Failed to parse package.json from the project'));
}