Revision: 505
http://assorted.svn.sourceforge.net/assorted/?rev=505&view=rev
Author: yangzhang
Date: 2008-02-24 23:19:27 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
added basename, dirname, extension to Path
Modified Paths:
--------------
scala-commons/trunk/src/commons/Path.scala
Modified: scala-commons/trunk/src/commons/Path.scala
===================================================================
--- scala-commons/trunk/src/commons/Path.scala 2008-02-25 07:19:11 UTC (rev 504)
+++ scala-commons/trunk/src/commons/Path.scala 2008-02-25 07:19:27 UTC (rev 505)
@@ -13,6 +13,10 @@
def /(relpath: String) =
if (path.last == sep) path + relpath
else path + sep + relpath
+
+ def basename = new File(path).getName
+ def dirname = new File(path).getPath
+ def extension = basename split "\\." last
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|