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 192242 bbac2a994298
parent 192241 a3d8c7c4f462
child 192243 315f0fda0470
push id3539
push userryanvm@gmail.com
push date2014-05-09 14:29 +0000
treeherdermozilla-beta@bbac2a994298 [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));
   },