mirror of https://github.com/jenkinsci/jenkins.git
added 'Libraries' that supercede 'Class-Path', which handles whitespaces in path names correctly.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1001 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
parent
14952adec6
commit
07bfa1e247
|
@ -133,24 +133,8 @@ public final class PluginWrapper {
|
|||
|
||||
List<URL> paths = new ArrayList<URL>();
|
||||
if(isLinked) {
|
||||
String classPath = manifest.getMainAttributes().getValue("Class-Path");
|
||||
for (String s : classPath.split(" +")) {
|
||||
File file = resolve(archive, s);
|
||||
if(file.getName().contains("*")) {
|
||||
// handle wildcard
|
||||
FileSet fs = new FileSet();
|
||||
File dir = file.getParentFile();
|
||||
fs.setDir(dir);
|
||||
fs.setIncludes(file.getName());
|
||||
for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) {
|
||||
paths.add(new File(dir,included).toURL());
|
||||
}
|
||||
} else {
|
||||
if(!file.exists())
|
||||
throw new IOException("No such file: "+file);
|
||||
paths.add(file.toURL());
|
||||
}
|
||||
}
|
||||
parseClassPath(archive, paths, "Libraries", ",");
|
||||
parseClassPath(archive, paths, "Class-Path", " +"); // backward compatibility
|
||||
|
||||
this.baseResourceURL = resolve(archive,
|
||||
manifest.getMainAttributes().getValue("Resource-Path")).toURL();
|
||||
|
@ -215,6 +199,27 @@ public final class PluginWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
private void parseClassPath(File archive, List<URL> paths, String attributeName, String separator) throws IOException {
|
||||
String classPath = manifest.getMainAttributes().getValue(attributeName);
|
||||
for (String s : classPath.split(separator)) {
|
||||
File file = resolve(archive, s);
|
||||
if(file.getName().contains("*")) {
|
||||
// handle wildcard
|
||||
FileSet fs = new FileSet();
|
||||
File dir = file.getParentFile();
|
||||
fs.setDir(dir);
|
||||
fs.setIncludes(file.getName());
|
||||
for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) {
|
||||
paths.add(new File(dir,included).toURL());
|
||||
}
|
||||
} else {
|
||||
if(!file.exists())
|
||||
throw new IOException("No such file: "+file);
|
||||
paths.add(file.toURL());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static File resolve(File base, String relative) {
|
||||
File rel = new File(relative);
|
||||
if(rel.isAbsolute())
|
||||
|
|
Loading…
Reference in New Issue