aboutsummaryrefslogtreecommitdiff
path: root/stage1/cbt.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-03-07 01:36:40 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2016-03-07 01:36:40 -0500
commite958dec0dbbcf7f7a28cd21641e76390fb3dba6a (patch)
treeec0933e230b0c3f222fceb82b3eec177d56ea979 /stage1/cbt.scala
parentf0dc760df8757caea1d83b15142a3d0704488636 (diff)
downloadcbt-e958dec0dbbcf7f7a28cd21641e76390fb3dba6a.tar.gz
cbt-e958dec0dbbcf7f7a28cd21641e76390fb3dba6a.tar.bz2
cbt-e958dec0dbbcf7f7a28cd21641e76390fb3dba6a.zip
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
Diffstat (limited to 'stage1/cbt.scala')
-rw-r--r--stage1/cbt.scala21
1 files changed, 21 insertions, 0 deletions
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
+ }
+}