diff options
author | 2015-05-04 11:57:31 -0700 | |
---|---|---|
committer | 2015-05-04 11:57:31 -0700 | |
commit | a0d9c82921022347e44d416bb57810331e35e446 (patch) | |
tree | 77974631941ea26edc47a73c0afdd64e6664980e /common/src | |
parent | 459b4f353e6138b644c1f06de68e93532ee0d856 (diff) | |
download | latinime-a0d9c82921022347e44d416bb57810331e35e446.tar.gz latinime-a0d9c82921022347e44d416bb57810331e35e446.tar.xz latinime-a0d9c82921022347e44d416bb57810331e35e446.zip |
Make the DictionaryService stage the downloaded files
Bug: 20641948
Change-Id: I6639c995b12c033bc30241cd219201dd483ee516
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; + } } |