[Sciviews-commits] r228 - in komodo/SciViews-K/content/js: . tools
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Nov 13 22:47:02 CET 2009
Author: prezez
Date: 2009-11-13 22:47:01 +0100 (Fri, 13 Nov 2009)
New Revision: 228
Modified:
komodo/SciViews-K/content/js/commands.js
komodo/SciViews-K/content/js/tools/file.js
Log:
Small changes to "sv.tools.file.whereIs". Corrections to "sv.command.startR".
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2009-11-12 08:24:02 UTC (rev 227)
+++ komodo/SciViews-K/content/js/commands.js 2009-11-13 21:47:01 UTC (rev 228)
@@ -139,7 +139,7 @@
env.push("DISPLAY=:0");
delete XEnv;
// without forced --interactive R-tk halts on any error!
- command = "R ---interactive --gui=Tk";
+ command = "R --interactive --gui=Tk";
// runIn = "no-console";
break;
case "r-app":
@@ -289,12 +289,12 @@
var appName = siblings[i].getAttribute("app");
if (isLinux || isWin) {
-
- //!!!!TODO: appName = appName.split(/[, ]+/);
- //appName = appName.split(/[, ]+/);
+ appName = appName.split(/[, ]+/);
var res = true;
- for (var k in appName.split(/[, ]+/))
- res = res && !!sv.tools.file.whereIs(appName);
+ for (var k in appName)
+ res = res && !!sv.tools.file.whereIs(appName[k]);
+
+
if (res) {
showItem = true;
break;
@@ -309,11 +309,8 @@
}
}
- if (!showItem) {
- siblings[i].style.display = "none";
- // This does not work on the Mac, but the following is fine
- siblings[i].setAttribute("hidden", true);
- } else {
+ siblings[i].setAttribute("hidden", !showItem);
+ if (showItem) {
sv.log.debug("R application supported: " +
siblings[i].getAttribute("app"));
siblings[i].setAttribute("checked",
Modified: komodo/SciViews-K/content/js/tools/file.js
===================================================================
--- komodo/SciViews-K/content/js/tools/file.js 2009-11-12 08:24:02 UTC (rev 227)
+++ komodo/SciViews-K/content/js/tools/file.js 2009-11-13 21:47:01 UTC (rev 228)
@@ -22,7 +22,7 @@
// sv.tools.file.list(dirname, pattern, noext); // List all files matching
// pattern in dirname (with/without extension)
// sv.tools.file.whereIs(appName);
- // Tries to find full application path,
+ // Tries to find full application path,
// returns null if not found
////////////////////////////////////////////////////////////////////////////////
@@ -272,15 +272,17 @@
}
this.whereIs = function(appName) {
- if (appName.search(/\.exe$/i) == -1)
- appName += ".exe";
+ // add default extension for executable if none
+ if (appName.search(/\.[^\.]{3}$/) == -1) appName += ".exe";
var reg = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
var key, path;
+ //alert(appName);
+
// Special treatment for R* apps:
- if (appName.match(/^R(?:gui|term|cmd)?\.exe?$/i)) {
+ if (appName.match(/^R(?:gui|term|cmd)?\.exe$/i)) {
try {
key = "software\\R-core\\R";
reg.open(reg.ROOT_KEY_LOCAL_MACHINE, key, reg.ACCESS_READ)
@@ -296,18 +298,26 @@
return reg.readStringValue("InstallPath") + "\\bin\\" + appName;
}
- var key = "Applications\\" + appName + "\\shell\\Open\\Command";
+ var key = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + appName;
try {
- reg.open(reg.ROOT_KEY_CLASSES_ROOT, key, reg.ACCESS_READ);
+ reg.open(reg.ROOT_KEY_LOCAL_MACHINE, key, reg.ACCESS_READ);
path = reg.readStringValue("");
- path = path.replace(/(^"|"?\s*"%\d.*$)/g, "");
- return path;
+ return path.replace(/(^"|"$)/g, "");
} catch(e) {
- // fallback: look for app in PATH:
- return _findFileInPath(appName);
+ var key = "Applications\\" + appName + "\\shell\\Open\\Command";
+ try {
+ reg.open(reg.ROOT_KEY_CLASSES_ROOT, key, reg.ACCESS_READ);
+ path = reg.readStringValue("");
+ path = path.replace(/(^"+|"*\s*"%\d.*$)/g, "");
+ return path;
+ } catch(e) {
+ // fallback: look for app in PATH:
+ return _findFileInPath(appName);
+ }
}
return null;
}
+
} else {
// Will it work on Mac too?
this.whereIs = function(appName) {
More information about the Sciviews-commits
mailing list