Bug 746860 - Don't fail when creating directories that already exist. r=blassey a=mfinkle
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Tue, 15 May 2012 15:13:28 +0200
changeset 94263 14759622c2e5f5812dc1e565b9952615d590b61e
parent 94262 12fa346baa18b98a092217e2431cc72a52cdb582
child 94264 fe0ca32428931fd3ccd95e05f23ea91971addcce
push id1289
push usergpascutto@mozilla.com
push dateTue, 15 May 2012 13:13:54 +0000
treeherdermozilla-aurora@0c1c0aa121af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, mfinkle
bugs746860
milestone14.0a2
Bug 746860 - Don't fail when creating directories that already exist. r=blassey a=mfinkle
mobile/android/base/GeckoProfile.java
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -224,27 +224,27 @@ public final class GeckoProfile {
         }
         for (File f : files) {
             File target = new File(dst, f.getName());
             try {
                 if (f.renameTo(target)) {
                     continue;
                 }
             } catch (SecurityException se) {
-                Log.e(LOGTAG, "Unable to rename file to " + target.getAbsolutePath() + " while moving profiles", se);
+                Log.w(LOGTAG, "Unable to rename file to " + target.getAbsolutePath() + " while moving profiles", se);
             }
             // rename failed, try moving manually
             if (f.isDirectory()) {
-                if (target.mkdirs()) {
+                if (target.exists() || target.mkdirs()) {
                     moveDirContents(f, target);
                 } else {
                     Log.e(LOGTAG, "Unable to create folder " + target.getAbsolutePath() + " while moving profiles");
                 }
             } else {
-                if (! moveFile(f, target)) {
+                if (!moveFile(f, target)) {
                     Log.e(LOGTAG, "Unable to move file " + target.getAbsolutePath() + " while moving profiles");
                 }
             }
         }
         src.delete();
     }
 
     private boolean moveFile(File src, File dst) {