From a09559ecc0dcb3bd576fe006d874be3e1b15560a Mon Sep 17 00:00:00 2001 From: Jim Carroll Date: Mon, 12 Nov 2012 18:03:27 -0500 Subject: [PATCH] [fix] part2: occasionally on OSX the case insensitive filesystem confuses the file path calculation when attempting to locate the template file. This change includes a last ditch effort to recover. --- tools/codegenerator/Helper.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/codegenerator/Helper.groovy b/tools/codegenerator/Helper.groovy index 65102143bb79f..ecae8931285f6 100644 --- a/tools/codegenerator/Helper.groovy +++ b/tools/codegenerator/Helper.groovy @@ -378,8 +378,13 @@ public class Helper File parent = curTemplateFile.getParentFile() // find the relative path to the convertTemplate File cwd = new File('.').getCanonicalFile() - String relative = cwd.toURI().relativize(convertTemplate.toURI()).getPath(); + String relative = cwd.getAbsoluteFile().toURI().relativize(convertTemplate.getAbsoluteFile().toURI()).getPath() convertTemplate = new File(parent,relative) + + // This is a fallback case which is hit occationally on OSX as a result + // of case mismatches between the two paths in the relativize call above. + if (!convertTemplate.exists()) + convertTemplate = new File(parent,cur.toString()) } }