use of com.thoughtworks.go.domain.FileDirectoryEntry in project gocd by gocd.
the class DirectoryReader method listEntries.
/**
* Recursively builds a tree of the specified rootFolder
* TODO: ChrisS : Note that the URL stuff is completely wrong and should NOT be here - that is view, this is model
*/
public DirectoryEntries listEntries(File rootFolder, String relativePath) {
DirectoryEntries entries = new DirectoryEntries();
if (rootFolder == null) {
return entries;
}
File[] files = rootFolder.listFiles(VISIBLE_NON_SERIALIZED_FILES);
if (files == null) {
return entries;
}
Arrays.sort(files, new FileComparator());
for (File file : files) {
String name = file.getName();
String url = getUrl(relativePath, name);
entries.add(file.isDirectory() ? new FolderDirectoryEntry(name, url, listEntries(file, getCurrentPath(relativePath) + name)) : new FileDirectoryEntry(name, url));
}
return entries;
}
Aggregations