final def workDir = new File('.').canonicalFile
final def props = new Properties();
final def inputPropsFile = new File(args[0]);
try {
    inputPropsStream = new FileInputStream(inputPropsFile);
    props.load(inputPropsStream);
}
catch (IOException e) {
    throw new RuntimeException(e);
}

def dirOffset = props['dir']?:'.'
def zipFile = props['zip'];
def overwrite = Boolean.valueOf(props['overwrite']);

try {

    def ant = new AntBuilder()
    if (overwrite) {
        ant.unzip(
                dest:dirOffset,
                failOnEmptyArchive: 'true',
                overwrite: 'true') {
            fileset(dir:'.', includes:zipFile, casesensitive:'false')
        }
    }
    else {
        ant.unzip(
                dest:dirOffset,
                failOnEmptyArchive: 'true',
                overwrite: 'false') {
            fileset(dir:'.', includes:zipFile, casesensitive:'false')
        }
    }
}
catch (Exception e) {
    e.printStackTrace()
    println "Error extracting zip!"
    System.exit(1)
}
finally {
}

System.exit(0)

