From 736f0ece675736032cc8b1dc1f33c313015648e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:45:39 +0000 Subject: [PATCH] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ce041d0..74c00cc 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -553,17 +553,14 @@ class MetaInfo extends GISJsonSerialised { deserialiseJson(rawmeta) } - String relativize(String path) { - def Path mypath = Paths.get(path) + String relativize(String mypath) { String pathRelative - script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") - if (path.startsWith(script.WORKSPACE)) { - def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(mypath) - pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") + 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.toString() + pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative