added a convenience method.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@23290 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-10-28 21:03:36 +00:00
1 parent 4f7d907ab1
commit 0449001bd4
1 file changed
+11
+11
View File
@@ -766,6 +766,17 @@ public final class FilePath implements Serializable {
});
}
/**
* Gets the file name portion except the extension.
*
* For example, "foo" for "foo.txt" and "foo.tar" for "foo.tar.gz".
*/
public String getBaseName() {
String n = getName();
int idx = n.lastIndexOf('.');
if (idx<0) return n;
return n.substring(0,idx);
}
/**
* Gets just the file name portion.
*