diff options
author | 2014-11-07 10:00:55 +0000 | |
---|---|---|
committer | 2014-11-07 10:00:55 +0000 | |
commit | 432d03ee0886a4aacebd0addd6a7a5ad986e8963 (patch) | |
tree | 3777c7301027fe1831dd896dab01de630d082065 /java/src/com/android/inputmethod/latin/utils/FileUtils.java | |
parent | b6351d445427e60669029247c1c1a30e15dd4b8e (diff) | |
parent | 5c4f642df61b8672b1aa913992b981284f07eba7 (diff) | |
download | latinime-432d03ee0886a4aacebd0addd6a7a5ad986e8963.tar.gz latinime-432d03ee0886a4aacebd0addd6a7a5ad986e8963.tar.xz latinime-432d03ee0886a4aacebd0addd6a7a5ad986e8963.zip |
am 5c4f642d: Merge "Move util classes under common"
* commit '5c4f642df61b8672b1aa913992b981284f07eba7':
Move util classes under common
Diffstat (limited to 'java/src/com/android/inputmethod/latin/utils/FileUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/utils/FileUtils.java | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/FileUtils.java b/java/src/com/android/inputmethod/latin/utils/FileUtils.java deleted file mode 100644 index f1106a6c6..000000000 --- a/java/src/com/android/inputmethod/latin/utils/FileUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.android.inputmethod.latin.utils; - -import java.io.File; -import java.io.FilenameFilter; - -/** - * A simple class to help with removing directories recursively. - */ -public class FileUtils { - public static boolean deleteRecursively(final File path) { - if (path.isDirectory()) { - final File[] files = path.listFiles(); - if (files != null) { - for (final File child : files) { - deleteRecursively(child); - } - } - } - return path.delete(); - } - - public static boolean deleteFilteredFiles(final File dir, final FilenameFilter fileNameFilter) { - if (!dir.isDirectory()) { - return false; - } - final File[] files = dir.listFiles(fileNameFilter); - if (files == null) { - return false; - } - boolean hasDeletedAllFiles = true; - for (final File file : files) { - if (!deleteRecursively(file)) { - hasDeletedAllFiles = false; - } - } - return hasDeletedAllFiles; - } -} |