From ebb729f0f69867747aaa9db5dcbce84741a1999d Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 17 Dec 2013 18:35:31 -0800 Subject: [PATCH] Fix crash with an empty programs/foo dir We should never use the existence of a directory in our source tree to make a decision, because git doesn't track directory existence, and it's easy to end up with extraneous directories (containing gitignored files, eg). So we should ignore programs/foo directories in apps if they don't contain package.js. --- tools/bundler.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/bundler.js b/tools/bundler.js index 5ea02d7110..e7acccdf43 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -1675,6 +1675,16 @@ exports.bundle = function (appDir, outputPath, options) { // Recover by ignoring this program return; } + // Programs must (for now) contain a `package.js` file. If not, then + // perhaps the directory we are seeing is left over from another git + // branch or something and we should ignore it. We don't actually parse + // the package.js file here, though (but we do restart if it is later + // added or changed). + if (watch.readAndWatchFile( + watchSet, path.join(programsDir, item, 'package.js')) === null) { + return; + } + targets[item] = true; // will be overwritten with actual target later // Read attributes.json, if it exists