Bug 992589 - OperatorApps.jsm errors when running with and without Single Variant apps. r=ferjm, a=lsblakk
authorCarmen Jimenez <cjc@tid.es>
Tue, 08 Apr 2014 12:46:27 +0200
changeset 193267 bbac2a994298bf25bc92451dd791583d1b4a5737
parent 193266 a3d8c7c4f462e088c9b9cc817d6879e9a17e02a2
child 193268 315f0fda04709d3f1b78161715b92203e8fb241e
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersferjm, lsblakk
bugs992589
milestone30.0
Bug 992589 - OperatorApps.jsm errors when running with and without Single Variant apps. r=ferjm, a=lsblakk
dom/apps/src/OperatorApps.jsm
--- a/dom/apps/src/OperatorApps.jsm
+++ b/dom/apps/src/OperatorApps.jsm
@@ -130,17 +130,18 @@ this.OperatorAppsRegistry = {
 
   _copyDirectory: function(aOrg, aDst) {
     debug("copying " + aOrg + " to " + aDst);
     return aDst && Task.spawn(function() {
       try {
         let orgDir = Cc["@mozilla.org/file/local;1"]
                        .createInstance(Ci.nsIFile);
         orgDir.initWithPath(aOrg);
-        if (!orgDir.isDirectory()) {
+        if (!orgDir.exists() || !orgDir.isDirectory()) {
+          debug(aOrg + " does not exist or is not a directory");
           return;
         }
 
         let dstDir = Cc["@mozilla.org/file/local;1"]
                        .createInstance(Ci.nsIFile);
         dstDir.initWithPath(aDst);
         if (!dstDir.exists()) {
           dstDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
@@ -156,17 +157,17 @@ this.OperatorAppsRegistry = {
             dstFile.append(entry.leafName);
             if(dstFile.exists()) {
               dstFile.remove(false);
             }
 
             entry.copyTo(dstDir, entry.leafName);
           } else {
             yield this._copyDirectory(entry.path,
-                                      Path.join(aDst, entry.name));
+                                      Path.join(aDst, entry.leafName));
           }
         }
       } catch (e) {
         debug("Error copying " + aOrg + " to " + aDst + ". " + e);
       }
     }.bind(this));
   },