01: /******************************************************************************
02: * ConfigDir.java
03: * ****************************************************************************/package org.openlaszlo.server;
04:
05: /**
06: * ConfigDir is a simple class that depends on nothing else
07: * and locates the configuration directory.
08: *
09: * @author Eric Bloch
10: * @version 1.0
11: */
12:
13: import java.io.File;
14:
15: public class ConfigDir {
16:
17: /**
18: * @return the absolute path for the configuration directory
19: * @param home LPS_HOME to be used if the path is determined
20: * to be relative
21: */
22:
23: private static String mDir = null;
24:
25: public synchronized static String get(String home) {
26:
27: if (mDir != null)
28: return mDir;
29:
30: try {
31: mDir = System.getProperty("lps.config.dir.abs");
32: if (mDir != null && !mDir.equals("")) {
33: return mDir;
34: }
35: } catch (SecurityException t) {
36: }
37:
38: try {
39: mDir = System.getProperty("lps.config.dir");
40: } catch (SecurityException t) {
41: }
42:
43: if (mDir == null || mDir.equals("")) {
44: mDir = "config";
45: }
46:
47: mDir = home + File.separator + "WEB-INF" + File.separator
48: + "lps" + File.separator + mDir;
49:
50: return mDir;
51: }
52: }
|