in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cp/ResolvedPath.java [79:124]
private void resolvePath(String inputPath, IProject project) throws CoreException,
MalformedURLException {
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
if (project != null) {
resolvedPath = inputPath.replaceAll("\\$\\{ivyproject_loc\\}", "\\${workspace_loc:"
+ project.getName() + "}");
} else {
resolvedPath = inputPath;
}
resolvedPath = manager.performStringSubstitution(resolvedPath, false);
resolvedPath = resolvedPath.trim();
if (resolvedPath.length() == 0) {
// no file or url to set
return;
}
try {
url = new URL(resolvedPath);
if (url.getProtocol().equals("file")) {
try {
// first try the standard way
file = new File(new URI(url.toString()));
} catch (URISyntaxException | IllegalArgumentException e) {
// probably a badly constructed url: "file://" + filename
file = new File(url.getPath());
}
}
} catch (MalformedURLException e) {
// probably a file
file = new File(resolvedPath);
if (!file.isAbsolute()) {
if (project != null) {
Path path = new Path(resolvedPath);
// get the file location in Eclipse "space"
IFile ifile = project.getFile(path);
// compute the actual file system location, following Eclipse's linked folders
// (see IVYDE-211)
IPath ipath = ifile.getLocation();
// get the corresponding java.io.File instance
file = ipath.toFile();
} else {
file = file.getAbsoluteFile();
}
}
url = file.toURI().toURL();
}
}