aboutsummaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
authorMohammadinamul Sheik <inamul@google.com>2015-05-04 19:04:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-04 19:04:15 +0000
commitf01cd568f0de414e88507ce244969cf0e509c537 (patch)
tree4a7fb439c6479016c646aab905f8a6f31dcd302a /common/src
parentaa9bb2f1db32133b6db80b59b37e122f3fc21227 (diff)
parenta0d9c82921022347e44d416bb57810331e35e446 (diff)
downloadlatinime-f01cd568f0de414e88507ce244969cf0e509c537.tar.gz
latinime-f01cd568f0de414e88507ce244969cf0e509c537.tar.xz
latinime-f01cd568f0de414e88507ce244969cf0e509c537.zip
Merge "Make the DictionaryService stage the downloaded files"
Diffstat (limited to 'common/src')
-rw-r--r--common/src/com/android/inputmethod/latin/common/FileUtils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/src/com/android/inputmethod/latin/common/FileUtils.java b/common/src/com/android/inputmethod/latin/common/FileUtils.java
index 676845842..16732660c 100644
--- a/common/src/com/android/inputmethod/latin/common/FileUtils.java
+++ b/common/src/com/android/inputmethod/latin/common/FileUtils.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.latin.common;
+import android.util.Log;
+
import java.io.File;
import java.io.FilenameFilter;
@@ -23,6 +25,8 @@ import java.io.FilenameFilter;
* A simple class to help with removing directories recursively.
*/
public class FileUtils {
+ private static final String TAG = "FileUtils";
+
public static boolean deleteRecursively(final File path) {
if (path.isDirectory()) {
final File[] files = path.listFiles();
@@ -51,4 +55,14 @@ public class FileUtils {
}
return hasDeletedAllFiles;
}
+
+ public static boolean renameTo(final File fromFile, final File toFile) {
+ toFile.delete();
+ final boolean success = fromFile.renameTo(toFile);
+ if (!success) {
+ Log.e(TAG, String.format("Failed to rename from %s to %s.",
+ fromFile.getAbsoluteFile(), toFile.getAbsoluteFile()));
+ }
+ return success;
+ }
}