use of org.openide.filesystems.JarFileSystem in project enclojure by EricThorsen.
the class SourcePathProviderImpl method getRoot.
/**
* Returns source root for given ClassPath root as String, or <code>null</code>.
*/
private static String getRoot(FileObject fileObject) {
File f = null;
String path = "";
try {
if (fileObject.getFileSystem() instanceof JarFileSystem) {
f = ((JarFileSystem) fileObject.getFileSystem()).getJarFile();
if (!fileObject.isRoot()) {
path = "!/" + fileObject.getPath();
}
} else {
f = FileUtil.toFile(fileObject);
}
} catch (FileStateInvalidException ex) {
}
if (f != null) {
return f.getAbsolutePath() + path;
} else {
return null;
}
}
Aggregations