try {
String fullPath = workspace.fileManager().attachPrefix(path);
if (org.nlogo.api.RemoteFile.exists(fullPath)) {
return fullPath;
} else {
throw new ExtensionException("Can't find file " + path + " using " + fullPath);
}
} catch (java.net.MalformedURLException ex) {
throw new ExtensionException(path + " is not a valid pathname: " + ex);
}
}
try {
String fullPath = workspace.attachModelDir(path);
java.io.File f = new java.io.File(fullPath);
if (f.exists()) {
return fullPath;
}
} catch (java.net.MalformedURLException ex) {
org.nlogo.util.Exceptions.ignore(ex);
}
// Then try the extensions folder
java.io.File f = new java.io.File("extensions" + java.io.File.separator + path);
if (f.exists()) {
return f.getPath();
}
// Give up
throw new ExtensionException("Can't find file " + path);
}