private void firstInit() {
log.info("## FIRST INIT ##");
- File initDir = new File(getFrameworkProp(NODE_INIT,
- KernelUtils.getOsgiInstancePath("../../../init")));
+ String nodeInit = getFrameworkProp(NODE_INIT);
+ if (nodeInit == null)
+ nodeInit = "../../init";
+ File initDir;
+ if (nodeInit.startsWith("."))
+ initDir = KernelUtils.getExecutionDir(nodeInit);
+ else
+ initDir = new File(nodeInit);
// TODO also uncompress archives
if (initDir.exists())
try {
return asDictionary(props);
}
+ static File getExecutionDir(String relativePath) {
+ File executionDir = new File(getFrameworkProp("user.dir"));
+ if (relativePath == null)
+ return executionDir;
+ try {
+ return new File(executionDir, relativePath).getCanonicalFile();
+ } catch (IOException e) {
+ throw new CmsException("Cannot get canonical file", e);
+ }
+ }
+
static File getOsgiInstanceDir() {
return new File(Activator.getBundleContext()
.getProperty(OSGI_INSTANCE_AREA).substring("file:".length()))