Resolve relative paths relative to Helma home directory. Fixes bug 639 <http://helma.org/bugs/show_bug.cgi?id=639>

This commit is contained in:
hns 2008-10-20 12:19:31 +00:00
parent 8a5c065901
commit ac28cd7542

View file

@ -281,6 +281,14 @@ public class ApplicationManager implements XmlRpcHandler {
return server.getLogger();
}
private String findResource(String path) {
File file = new File(path);
if (!file.isAbsolute() && !file.exists()) {
file = new File(server.getHopHome(), path);
}
return file.getAbsolutePath();
}
/**
* Inner class that describes an application and its start settings.
*/
@ -362,10 +370,13 @@ public class ApplicationManager implements XmlRpcHandler {
if (repositoryImpl == null) {
// implementation not set manually, have to guess it
if (repositoryArgs.endsWith(".zip")) {
repositoryArgs = findResource(repositoryArgs);
repositoryImpl = "helma.framework.repository.ZipRepository";
} else if (repositoryArgs.endsWith(".js")) {
repositoryArgs = findResource(repositoryArgs);
repositoryImpl = "helma.framework.repository.SingleFileRepository";
} else {
repositoryArgs = findResource(repositoryArgs);
repositoryImpl = "helma.framework.repository.FileRepository";
}
}