diff options
author | 2015-05-04 20:24:33 +0000 | |
---|---|---|
committer | 2015-05-04 20:24:33 +0000 | |
commit | 9c08208d1a0592652fbdb6626cfd4ff9bd473441 (patch) | |
tree | f0b332c4d8d42c73065553f7240c431053c906df /common/src | |
parent | c6e7e89225ba6b350145ba7e57efcfa0b5fcc7fd (diff) | |
parent | f01cd568f0de414e88507ce244969cf0e509c537 (diff) | |
download | latinime-9c08208d1a0592652fbdb6626cfd4ff9bd473441.tar.gz latinime-9c08208d1a0592652fbdb6626cfd4ff9bd473441.tar.xz latinime-9c08208d1a0592652fbdb6626cfd4ff9bd473441.zip |
am f01cd568: Merge "Make the DictionaryService stage the downloaded files"
* commit 'f01cd568f0de414e88507ce244969cf0e509c537':
Make the DictionaryService stage the downloaded files
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/com/android/inputmethod/latin/common/FileUtils.java | 14 |
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; + } } |