Handle absolute paths passed to Path.fromString

This commit is contained in:
Mark Harrah 2010-08-10 08:36:31 -04:00
parent d3f02f7c80
commit 8caaabbdf4
1 changed files with 8 additions and 2 deletions

View File

@ -192,11 +192,17 @@ object Path extends Alternatives with Mapper
if(value.isEmpty) if(value.isEmpty)
basePath basePath
else else
{
val f = new File(value)
if(f.isAbsolute)
fromFile(f)
else
{ {
val components = value.split("""[/\\]""") val components = value.split("""[/\\]""")
(basePath /: components)( (path, component) => path / component ) (basePath /: components)( (path, component) => path / component )
} }
} }
}
def baseAncestor(path: Path): Option[Path] = def baseAncestor(path: Path): Option[Path] =
path match path match
{ {