From baff64ebac598c3341f5f93570fc4b7aec3138df Mon Sep 17 00:00:00 2001 From: kohsuke Date: Fri, 10 Nov 2006 23:33:14 +0000 Subject: [PATCH] accept relative HUDSON_HOME. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1075 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/WebAppMain.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index 804d6ee529..6ee9d35936 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -123,7 +123,7 @@ public class WebAppMain implements ServletContextListener { Context env = (Context) new InitialContext().lookup("java:comp/env"); String value = (String) env.lookup("HUDSON_HOME"); if(value!=null && value.trim().length()>0) - return new File(value.trim()); + return new File(value.trim()).getAbsoluteFile(); } catch (NamingException e) { // ignore } @@ -131,12 +131,12 @@ public class WebAppMain implements ServletContextListener { // look at the env var next String env = EnvVars.masterEnvVars.get("HUDSON_HOME"); if(env!=null) - return new File(env.trim()); + return new File(env.trim()).getAbsoluteFile(); // finally check the system property String sysProp = System.getProperty("HUDSON_HOME"); if(sysProp!=null) - return new File(sysProp.trim()); + return new File(sysProp.trim()).getAbsoluteFile(); // otherwise pick a place by ourselves @@ -147,11 +147,11 @@ public class WebAppMain implements ServletContextListener { // Hudson <1.42 used to prefer this betfore ~/.hudson, so // check the existence and if it's there, use it. // otherwise if this is a new installation, prefer ~/.hudson - return ws; + return ws.getAbsoluteFile(); } // if for some reason we can't put it within the webapp, use home directory. - return new File(new File(System.getProperty("user.home")),".hudson"); + return new File(new File(System.getProperty("user.home")),".hudson").getAbsoluteFile(); } public void contextDestroyed(ServletContextEvent event) {