offsetpath field in meta files was absolute; should be relative to workspace

This commit is contained in:
Dan Hawkins 2019-02-26 17:45:39 +00:00
commit eb37e31094

View file

@ -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