From ac28cd7542662098db3f324a0321cfb989d9933a Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 20 Oct 2008 12:19:31 +0000 Subject: [PATCH] Resolve relative paths relative to Helma home directory. Fixes bug 639 --- src/helma/main/ApplicationManager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/helma/main/ApplicationManager.java b/src/helma/main/ApplicationManager.java index edef65ad..a1716867 100644 --- a/src/helma/main/ApplicationManager.java +++ b/src/helma/main/ApplicationManager.java @@ -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"; } }