From 13c5736a0fa9647b28b9454ebd2f9c689dcd8dc6 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 13 Nov 2009 10:10:26 -0800 Subject: [PATCH] Fix for capp gen sometimes failing. Reviewed by me. --- Tools/capp/Generate.j | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Tools/capp/Generate.j b/Tools/capp/Generate.j index 264882470..9816a3529 100644 --- a/Tools/capp/Generate.j +++ b/Tools/capp/Generate.j @@ -92,18 +92,28 @@ function gen(/*va_args*/) if (FILE.isDirectory(path)) continue; - // Don't do this for images. - if ([".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"].indexOf(FILE.extension(path)) !== -1) + if (FILE.basename(path) === ".DS_Store") continue; - var contents = FILE.read(path, { charset : "UTF-8" }), - key = nil, - keyEnumerator = [configuration keyEnumerator]; + // Don't do this for images. + if ([".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"].indexOf(FILE.extension(path).toLowerCase()) !== -1) + continue; - while (key = [keyEnumerator nextObject]) - contents = contents.replace(new RegExp("__" + RegExp.escape(key) + "__", 'g'), [configuration valueForKey:key]); + try + { + var contents = FILE.read(path, { charset : "UTF-8" }), + key = nil, + keyEnumerator = [configuration keyEnumerator]; - FILE.write(path, contents, { charset: "UTF-8"}); + while (key = [keyEnumerator nextObject]) + contents = contents.replace(new RegExp("__" + RegExp.escape(key) + "__", 'g'), [configuration valueForKey:key]); + + FILE.write(path, contents, { charset: "UTF-8"}); + } + catch (anException) + { + print("Copying and modifying " + path + " failed."); + } } var frameworkDestination = destinationProject;