[Pkg-mozext-commits] [itsalltext] 194/459: fixed isExecutable() for macintoshes

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository itsalltext.

commit 30c8c987685d0f42f3c893ae304d93a8ad253a67
Author: Christian Höltje <docwhat at gerf.org>
Date:   Thu Apr 5 20:49:25 2007 -0400

    fixed isExecutable() for macintoshes
---
 chrome/content/cacheobj.js   |  4 +++-
 chrome/content/itsalltext.js | 30 ++++++++++++++++++------------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/chrome/content/cacheobj.js b/chrome/content/cacheobj.js
index 45e7a04..1a92be3 100644
--- a/chrome/content/cacheobj.js
+++ b/chrome/content/cacheobj.js
@@ -240,7 +240,9 @@ CacheObj.prototype.edit = function(extension) {
         // checks
         if (program === null)        { throw "Editor is not set."; }
         if (!program.exists())       { throw "Editor does not exists."; }
-        if (!program.isExecutable()) { throw "Editor is not executable."; }
+        /* Mac check because of 
+         * https://bugzilla.mozilla.org/show_bug.cgi?id=322865 */
+        if (!(ItsAllText.isMac() || program.isExecutable())) { throw "Editor is not executable."; }
 
         // create an nsIProcess
         var process = Components.
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index 0656c96..acdaca1 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -318,6 +318,21 @@ var ItsAllText = function() {
 
     };
 
+    that.isMac = function() {
+        var is_mac = that._is_mac;
+        if (typeof(is_mac) == 'undefined') {
+            var checks = ['/System',  '/Applications',
+                          '/Library', '/Network', '/Volumes'];
+            is_mac = true;
+            for(var i=0; i<checks.length; i++) {
+                dir = that.factoryFile(checks[i]);
+                is_mac = is_mac && dir.exists() && dir.isDirectory();
+            }
+            that._is_mac = is_mac;
+        }
+        return is_mac;
+    };
+
     /**
      * A Preference Option: What editor should we use?
      * @returns {nsILocalFile} A file object of the editor.
@@ -325,18 +340,9 @@ var ItsAllText = function() {
     that.getEditor = function() {
         var editor = that.preferences.editor;
 
-        if (editor === '') {
-            var checks = ['/System','/Applications','/Library', '/Network', '/Volumes'];
-            var is_mac = true;
-            var dir;
-            for(var i=0; i<checks.length; i++) {
-                dir = that.factoryFile(checks[i]);
-                is_mac = is_mac && dir.exists() && dir.isDirectory();
-            }
-            if (is_mac) {
-                editor = '/usr/bin/open'; 
-                that.preferences._set('editor', editor);
-            }
+        if (editor === '' && that.isMac()) {
+            editor = '/usr/bin/open'; 
+            that.preferences._set('editor', editor);
         }
 
         if (editor === '') {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git



More information about the Pkg-mozext-commits mailing list