diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-01 00:39:04 +0000 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-01 00:39:04 +0000 |
commit | e8b0d49a9cf8eeb95e2e41555d12f43724e417f1 (patch) | |
tree | 0cacacfe83c6b3c270b64e21dd4bce50688d3489 /stage1 | |
parent | 7ddfd1a4336d53a1ae59582b9f4aa130cfd44fcb (diff) | |
download | cbt-e8b0d49a9cf8eeb95e2e41555d12f43724e417f1.tar.gz cbt-e8b0d49a9cf8eeb95e2e41555d12f43724e417f1.tar.bz2 cbt-e8b0d49a9cf8eeb95e2e41555d12f43724e417f1.zip |
add / helper also for Path anticipating migration to nio
Diffstat (limited to 'stage1')
-rw-r--r-- | stage1/cbt.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/stage1/cbt.scala b/stage1/cbt.scala index 44506d2..ea3237d 100644 --- a/stage1/cbt.scala +++ b/stage1/cbt.scala @@ -18,6 +18,16 @@ object `package`{ val sonatypeSnapshots = sonatypeBase ++ "snapshots" private val lib = new BaseLib + + implicit class PathExtensionMethods( path: Path ){ + def /(s: String): Path = path.resolve(s) + def ++( s: String ): Path = { + if(s endsWith "/") throw new Exception( + """Trying to append a String that ends in "/" to a Path would loose the trailing "/". Use .stripSuffix("/") if you need to.""" + ) + Paths.get( path.toString ++ s ) + } + } implicit class FileExtensionMethods( file: File ){ def ++( s: String ): File = { if(s endsWith "/") throw new Exception( |