diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-24 09:32:50 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-24 09:32:50 -0700 |
commit | 836d8cf5d5f891250afcfe39af11623fe0b20445 (patch) | |
tree | fadf2223e1a2fc0dfa3537319d11838b3fa5e77f /src/github/daneren2005 | |
parent | fe916d7fbfd3b99c11d8874ade375da89bccc9a3 (diff) | |
download | dsub-836d8cf5d5f891250afcfe39af11623fe0b20445.tar.gz dsub-836d8cf5d5f891250afcfe39af11623fe0b20445.tar.bz2 dsub-836d8cf5d5f891250afcfe39af11623fe0b20445.zip |
Retry deleting the temp file 100 ms later to get around potential temporary issues
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index 60fc6031..9433043c 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -478,8 +478,17 @@ public class FileUtil { if(tmp.delete()) { return true; } else { - Log.w(TAG, "Failed to delete temp file"); - return false; + Log.w(TAG, "Failed to delete temp file, retrying"); + + // This should never be reached since this is a file DSub created! + Thread.sleep(100L); + tmp = new File(dir, "checkWrite"); + if(tmp.delete()) { + return true; + } else { + Log.w(TAG, "Failed retry to delete temp file"); + return false; + } } } else { Log.w(TAG, "Temp file does not actually exist"); |