diff --git a/projects/samskivert/src/java/com/samskivert/util/FileUtil.java b/projects/samskivert/src/java/com/samskivert/util/FileUtil.java
index 3bdbcc4c..09c5105e 100644
--- a/projects/samskivert/src/java/com/samskivert/util/FileUtil.java
+++ b/projects/samskivert/src/java/com/samskivert/util/FileUtil.java
@@ -1,5 +1,5 @@
//
-// $Id: FileUtil.java,v 1.3 2003/05/27 07:58:08 mdb Exp $
+// $Id: FileUtil.java,v 1.4 2003/08/09 05:26:32 mdb Exp $
package com.samskivert.util;
@@ -30,6 +30,20 @@ public class FileUtil
recursiveWipe(file, false);
}
+ /**
+ * Replaces ext with the supplied new extention if the
+ * supplied file path ends in ext. Otherwise the new
+ * extension is appended to the whole existing file path.
+ */
+ public static String resuffix (File file, String ext, String newext)
+ {
+ String path = file.getPath();
+ if (path.endsWith(ext)) {
+ path = path.substring(0, path.length()-ext.length());
+ }
+ return path + newext;
+ }
+
/** Helper function. */
protected static void recursiveWipe (File file, boolean wipeMe)
{