roots.addAll(Arrays.asList(File.listRoots()));
}
Collections.sort(roots);
// TODO: find a better way to deal with the data dir
GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
File dataDirectory = loader.getBaseDirectory();
roots.add(0, dataDirectory );
// add the home directory as well if it was possible to determine it at all
if(!hideFileSystem && USER_HOME != null) {
roots.add(1, USER_HOME);
}
// find under which root the selection should be placed
File selection = (File) file.getObject();
// first check if the file is a relative reference into the data dir
if(selection != null) {
File relativeToDataDir = loader.url(selection.getPath());
if(relativeToDataDir != null) {
selection = relativeToDataDir;
}
}