jdk/test/tools/pack200/Utils.java
changeset 6320 6b48de58428e
parent 6314 8ab691ddb904
child 6323 1cdec3dff0a3
--- a/jdk/test/tools/pack200/Utils.java	Mon Aug 23 17:35:18 2010 +0100
+++ b/jdk/test/tools/pack200/Utils.java	Mon Aug 23 08:18:08 2010 -0700
@@ -221,6 +221,18 @@
         setFileAttributes(src, dst);
     }
 
+    static String baseName(File file, String extension) {
+        return baseName(file.getAbsolutePath(), extension);
+    }
+
+    static String baseName(String name, String extension) {
+        int cut = name.length() - extension.length();
+        return name.lastIndexOf(extension) == cut
+                ? name.substring(0, cut)
+                : name;
+
+    }
+
     /*
      * Suppose a path is provided which consists of a full path
      * this method returns the sub path for a full path ex: /foo/bar/baz/foobar.z