summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorChris Aniszczyk <caniszczyk@gmail.com>2010-12-09 18:31:48 -0500
committerCode Review <codereview-daemon@eclipse.org>2010-12-09 18:31:48 -0500
commita3475fb664e82bbb92fd3a5ab8c9b6413fff224e (patch)
treece7c90e098ad064d99d60febba8d0738383d0d15 /org.eclipse.jgit/src
parentbcf706d94a5ca0f1b38c73479f109de71769e77a (diff)
parentcbd1ecff4d2b21beb59ac52d5f58ed7663c85415 (diff)
downloadjgit-a3475fb664e82bbb92fd3a5ab8c9b6413fff224e.tar.gz
jgit-a3475fb664e82bbb92fd3a5ab8c9b6413fff224e.zip
Merge "Add option to skip deletion of non-existing files"
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
index c71d560d09..383afd0839 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
@@ -72,6 +72,11 @@ public class FileUtils {
public static final int RETRY = 2;
/**
+ * Option to skip deletion if file doesn't exist
+ */
+ public static final int SKIP_MISSING = 4;
+
+ /**
* Delete file or empty folder
*
* @param f
@@ -103,6 +108,9 @@ public class FileUtils {
* concurrent threads all try to delete the same file.
*/
public static void delete(final File f, int options) throws IOException {
+ if ((options & SKIP_MISSING) != 0 && !f.exists())
+ return;
+
if ((options & RECURSIVE) != 0 && f.isDirectory()) {
final File[] items = f.listFiles();
if (items != null) {