[Pkg-mozext-commits] [itsalltext] 366/459: Ticket #14 Run MacOSX Applications directly

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:39 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 ad10e3e0568037de1d81ddadd3b1904ec09c0f46
Author: Christian Höltje <docwhat at gerf.org>
Date:   Tue Dec 7 23:29:39 2010 -0500

    Ticket #14 Run MacOSX Applications directly
    
    It now handles app-bundles.  However, you now have to type non-app-bundles in directly.
    
    *sigh*
---
 src/chrome/content/cacheobj.js   | 28 ++++++++++++++++++++--------
 src/chrome/content/itsalltext.js |  2 +-
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/chrome/content/cacheobj.js b/src/chrome/content/cacheobj.js
index a65104e..313afb7 100644
--- a/src/chrome/content/cacheobj.js
+++ b/src/chrome/content/cacheobj.js
@@ -365,19 +365,31 @@ CacheObj.prototype.edit = function (extension, clobber) {
 
     try {
         program = ItsAllText.getEditor();
+
         // checks
         if (program === null) {
-            throw {name: "Editor is not set."};
+	    throw {name: "Editor is not set."};
         }
+
         if (!program.exists()) {
-            throw {name: "NS_ERROR_FILE_NOT_FOUND"};
-        }
-        /* Mac check because of
-         * https://bugzilla.mozilla.org/show_bug.cgi?id=322865 */
-        if (!(ItsAllText.isDarwin() || program.isExecutable())) {
-            throw {name: "NS_ERROR_FILE_ACCESS_DENIED"};
+	    throw {name: "NS_ERROR_FILE_NOT_FOUND"};
         }
 
+	if (ItsAllText.isDarwin() &&
+	    program.isDirectory() &&
+	    program.leafName.match(/\.app$/i)) {
+	    // OS-X .app bundles should be run with open.
+            args = ['-a', program.path, '--args', filename];
+	    program = ItsAllText.factoryFile('/usr/bin/open');
+	} else {
+            /* Mac check because of
+             * https://bugzilla.mozilla.org/show_bug.cgi?id=322865 */
+            if (!(ItsAllText.isDarwin() || program.isExecutable())) {
+		throw {name: "NS_ERROR_FILE_ACCESS_DENIED"};
+            }
+            args = [filename];
+	}
+
         // create an nsIProcess
         process = procutil.createInstance(Components.interfaces.nsIProcess);
         process.init(program);
@@ -387,9 +399,9 @@ CacheObj.prototype.edit = function (extension, clobber) {
         // called process terminates.
         // Second and third params are used to pass command-line arguments
         // to the process.
-        args = [filename];
         result = {};
         ec = process.run(false, args, args.length, result);
+
         this.private_is_watching = true;
         this.edit_count++;
     } catch (e) {
diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index b131903..3afe56f 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -361,7 +361,7 @@ var ItsAllText = function () {
             retval = null;
 
         if (editor === '' && that.isDarwin()) {
-            editor = '/usr/bin/open';
+            editor = '/Application/TextEdit.app';
             that.preferences.private_set('editor', 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