This commit is contained in:
Dan Hawkins 2019-02-27 09:02:59 +00:00
commit 1f21e0f2b9

View file

@ -553,14 +553,24 @@ class MetaInfo extends GISJsonSerialised {
deserialiseJson(rawmeta)
}
String relativize(String path) {
def Path thispath = Paths.get(path)
if (thispath.startsWith(script.WORKSPACE)) {
def Path wspath = Paths.get(script.WORKSPACE)
def Path wsrelativePath = wspath.relativize(thispath)
return wsrelativePath.toString()
String relativize(String mypath) {
String pathRelative
script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}")
if (mypath.startsWith(script.WORKSPACE)) {
pathRelative = mypath.minus(script.WORKSPACE)
script.echo("Extracted ${pathRelative} from ${script.WORKSPACE} and ${mypath}")
} else {
pathRelative = mypath
script.echo("Path relative is unchanged: ${pathRelative}")
}
return path
// Convert \ with /
pathRelative = pathRelative.tokenize('\\').join('/')
// Strip leading / if any
pathRelative = pathRelative.replaceAll('^/+', '')
script.echo("Path relative is ${pathRelative}")
return pathRelative
}
static String metafilepath() {