blob: 01af0d59737565650529c782d64f22b8e4644fee (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
}
}
|