blob: 66d31fa18b437e37e5f41f79819b54548976e1da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
package dotty.tools
package dottydoc
package staticsite
trait ResourceFinder {
/** If, for some reason, the supplied default files cannot be found - this
* exception will be thrown in `layouts`.
*/
final case class ResourceNotFoundException(message: String) extends Exception(message)
protected def getResource(r: String): String =
Option(getClass.getResourceAsStream(r)).map(scala.io.Source.fromInputStream)
.map(_.mkString)
.getOrElse(throw ResourceNotFoundException(r))
}
|