sbt/util/io/PathMapper.scala

21 lines
431 B
Scala
Raw Normal View History

/* 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))
}
class FMapper(f: File => String) extends PathMapper
{
def apply(file: File) = f(file)
}