aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-06-10 15:55:39 -0700
committerClark Scheff <clark@cyngn.com>2015-06-11 16:42:54 +0000
commitb2dfe80d30f5e82ae231fe7392ed0786a4661dfa (patch)
treec359671981eba07ea4c0ac5c31159587b77915a7
parenta92de3a25f7420ff4a5474db123e280a51ab8066 (diff)
downloadandroid_packages_apps_CMFileManager-b2dfe80d30f5e82ae231fe7392ed0786a4661dfa.tar.gz
android_packages_apps_CMFileManager-b2dfe80d30f5e82ae231fe7392ed0786a4661dfa.tar.bz2
android_packages_apps_CMFileManager-b2dfe80d30f5e82ae231fe7392ed0786a4661dfa.zip
Delete destination file when copy fails
Change-Id: Ic398a2eaa7ac06d8c2ffccc10033d2d32a0dba60 (cherry picked from commit 766c7ba627fb8d685408429ce027c6826bb9c2ab)
-rw-r--r--src/com/cyanogenmod/filemanager/util/FileHelper.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/filemanager/util/FileHelper.java b/src/com/cyanogenmod/filemanager/util/FileHelper.java
index 381c2c95..42089c39 100644
--- a/src/com/cyanogenmod/filemanager/util/FileHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/FileHelper.java
@@ -1157,6 +1157,13 @@ public final class FileHelper {
Log.e(TAG,
String.format(TAG, "Failed to copy from %s to %d", src, dst), e); //$NON-NLS-1$
+ try {
+ // delete the destination file if it exists since the operation failed
+ if (dst.exists()) {
+ dst.delete();
+ }
+ } catch (Throwable t) {/**NON BLOCK**/}
+
// Check if this error is an out of space exception and throw that specifically.
// ENOSPC -> Error No Space
if (e.getCause() instanceof ErrnoException