much nicer with with statement :-)
removed imageDir from gradle plugin
finally removed imageDir (not required, as we can deduce baseDir from fileToCheck.getParent()