From dc887342945f3d1203bf5e12b9de7908baf999de Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 4 Apr 2008 11:48:15 +0000 Subject: [PATCH] * Make Root.getAllApplications() include the apps defined in apps.properties. Requires a fresh Helma snapshot (1.6.2+). Fixes bug 520 --- Root/functions.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Root/functions.js b/Root/functions.js index 60c9a9b6..9e8ead34 100644 --- a/Root/functions.js +++ b/Root/functions.js @@ -26,13 +26,24 @@ function renderApi(appName) { */ function getAllApplications() { var appsDir = this.getAppsHome(); - var dir = appsDir.list(); + var dir = appsDir.listFiles(); var arr = new Array(); - if (!dir) - return arr; - for (var i = 0; i < dir.length; i++) { - if (dir[i].toLowerCase() != "cvs" && dir[i].indexOf(".") == -1) - arr[arr.length] = this.getApp(dir[i]); + var seen = {}; + // first check apps directory for apps directories + if (dir) { + for (var i = 0; i < dir.length; i++) { + if (dir[i].isDirectory() && dir[i].name.toLowerCase() != "cvs") { + arr[arr.length] = this.getApp(dir[i].name); + seen[dir[i].name] = true; + } + } + } + // then check entries in apps.properties for apps not currently running + var props = wrapJavaMap(root.getAppsProperties(null)); + for (var i in props) { + if (i.indexOf(".") < 0 && !seen[i] && !root.getApplication(i)) { + arr[arr.length] = this.getApp(i); + } } return arr; }