2009-08-17 16:51:43 +02:00
|
|
|
/* sbt -- Simple Build Tool
|
|
|
|
|
* Copyright 2008, 2009 Mark Harrah
|
|
|
|
|
*/
|
|
|
|
|
package xsbt
|
|
|
|
|
|
|
|
|
|
import java.io.File
|
|
|
|
|
|
|
|
|
|
trait PathMapper extends NotNull
|
|
|
|
|
{
|
|
|
|
|
def apply(file: File): String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
object PathMapper
|
|
|
|
|
{
|
|
|
|
|
val basic = new FMapper(_.getPath)
|
|
|
|
|
def relativeTo(base: File) = new FMapper(file => FileUtilities.relativize(base, file).getOrElse(file.getPath))
|
2009-08-24 04:21:15 +02:00
|
|
|
val flat = new FMapper(_.getName)
|
|
|
|
|
def apply(f: File => String) = new FMapper(f)
|
2009-08-17 16:51:43 +02:00
|
|
|
}
|
|
|
|
|
class FMapper(f: File => String) extends PathMapper
|
|
|
|
|
{
|
|
|
|
|
def apply(file: File) = f(file)
|
|
|
|
|
}
|