From e958dec0dbbcf7f7a28cd21641e76390fb3dba6a Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Mon, 7 Mar 2016 01:36:40 -0500 Subject: cleanup: whitespace changes, separated more things into their own files, use ++ for strings everywhere. Added ++ method to File and URL and use it in many places --- stage1/cbt.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 stage1/cbt.scala (limited to 'stage1/cbt.scala') diff --git a/stage1/cbt.scala b/stage1/cbt.scala new file mode 100644 index 0000000..01af0d5 --- /dev/null +++ b/stage1/cbt.scala @@ -0,0 +1,21 @@ +package cbt +import java.io._ +import java.nio.file._ +import java.net._ +object `package`{ + private val lib = new BaseLib + implicit class FileExtensionMethods( file: File ){ + def ++( s: String ): File = { + if(s endsWith "/") throw new Exception( + """Trying to append a String that ends in "/" to a File would loose it. Use .stripSuffix("/") if you need to.""" + ) + new File( file.toString ++ s ) + } + def parent = lib.realpath(file ++ "/..") + def string = file.toString + } + implicit class URLExtensionMethods( url: URL ){ + def ++( s: String ): URL = new URL( url.toString ++ s ) + def string = url.toString + } +} -- cgit v1.2.3