| author | Tomas Zeman <tzeman@volny.cz> |
| Tue, 11 Dec 2018 21:33:20 +0100 | |
| changeset 16 | 4556852613a9 |
| child 18 | 8cfd67425811 |
| permissions | -rw-r--r-- |
package sqwl import java.nio.file.Path import scala.io.Source import scala.util.{Failure, Success, Try} package object cms { def readFile(f: Path, enc: String = "UTF-8"): Try[String] = { val src = Source.fromFile(f.toFile, enc) try { Success(src.getLines.mkString) } catch { case t: Throwable => Failure(t) } finally { src.close() } } }