提交 07bfa1e2 编写于 作者: K kohsuke

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
上级 14952ade
......@@ -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())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册