Bug 746860 - Don't fail when creating directories that already exist. r=blassey
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Wed, 09 May 2012 00:50:52 +0200
changeset 93520 4cd27991b1c9f7188e818b478f84893ddd548e1a
parent 93519 404ef622ffd39ca75974b87f3d0086f411fc832d
child 93521 896547412c7f7f3db9cf9629cb4eb4e201f5d7f1
push id9196
push usergpascutto@mozilla.com
push dateTue, 08 May 2012 22:51:30 +0000
treeherdermozilla-inbound@896547412c7f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs746860
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 746860 - Don't fail when creating directories that already exist. r=blassey
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) {