Permalink
Browse files

Fix #270 by improving catalog searching

  • Loading branch information...
ndw committed Mar 14, 2018
1 parent 277b0b0 commit 7d0ba612acdfa611a7dc3dea01a06e1c32e4525a
Showing with 15 additions and 2 deletions.
  1. +15 −2 src/main/java/com/xmlcalabash/core/XProcConfiguration.java
@@ -213,9 +213,13 @@ private void init() {
findStepClasses();
findExtensionFunctions();
URI cwd = URIUtils.cwdAsURI();
String classPath = System.getProperty("java.class.path");
String[] pathElements = classPath.split(System.getProperty("path.separator"));
for (String s : pathElements) {
for (String path : pathElements) {
// Make the path absolute wrt the cwd so that it can be opened later regardless of context
String s = cwd.resolve(path).getPath();
try {
JarFile jar = new JarFile(s);
ZipEntry catalog = jar.getEntry("catalog.xml");
@@ -227,7 +231,16 @@ private void init() {
catalogs.add("jar:file://" + s + "!/META-INF/catalog.xml");
}
} catch (IOException e) {
// nevermind
// If it's not a jar file, maybe it's a directory with a catalog
String catfn = s;
if (!catfn.endsWith("/")) {
catfn += "/";
}
catfn += "catalog.xml";
File f = new File(catfn);
if (f.exists() && f.isFile()) {
catalogs.add(catfn);
}
}
}
}

0 comments on commit 7d0ba61

Please sign in to comment.