diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-12-27 12:45:59 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-02-10 23:29:24 +0100 |
commit | 7c19c4554466537d0c9e845e9ce99507a500aa87 (patch) | |
tree | 928c23cefe3fc449fed487f937aada4752f87e12 /org.eclipse.jgit | |
parent | 50a19fcdef271a74eb055f6996a425fc0c01d81f (diff) | |
download | jgit-7c19c4554466537d0c9e845e9ce99507a500aa87.tar.gz jgit-7c19c4554466537d0c9e845e9ce99507a500aa87.zip |
Add delete support to FS
Change-Id: Ib6f6fd5ef4a0c9b2062445ac4a0c9d1131e401bf
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 1b68801ae0..a5642f149a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -50,6 +50,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.security.AccessController; import java.security.PrivilegedAction; +import java.text.MessageFormat; import java.util.Arrays; import java.util.concurrent.atomic.AtomicBoolean; @@ -273,6 +274,20 @@ public abstract class FS { } /** + * Delete a file. Throws an exception if delete fails. + * + * @param f + * @throws IOException + * this may be a Java7 subclass with detailed information + * @since 3.3 + */ + public void delete(File f) throws IOException { + if (!f.delete()) + throw new IOException(MessageFormat.format( + JGitText.get().deleteFileFailed, f.getAbsolutePath())); + } + + /** * Resolve this file to its actual path name that the JRE can use. * <p> * This method can be relatively expensive. Computing a translation may |