String path = spec.substring(CONFIG.length() + 1);
// resolution takes parent configuration into account (if it exists)
Activator activator = Activator.getDefault();
if (activator == null)
throw new IOException(CommonMessages.activator_not_available);
Location localConfig = activator.getConfigurationLocation();
Location parentConfig = localConfig.getParentLocation();
// assume we will find the file locally
URL localURL = new URL(localConfig.getURL(), path);
if (!FILE_PROTOCOL.equals(localURL.getProtocol()) || parentConfig == null)
// we only support cascaded file: URLs
return localURL;
File localFile = new File(localURL.getPath());
if (localFile.exists())
// file exists in local configuration
return localURL;
// try to find in the parent configuration
URL parentURL = new URL(parentConfig.getURL(), path);
if (FILE_PROTOCOL.equals(parentURL.getProtocol())) {
// we only support cascaded file: URLs
File parentFile = new File(parentURL.getPath());
if (parentFile.exists()) {
// parent has the location