Updated Branches: refs/heads/master 1146c639e -> 87cc336cb
catch exception for missing or invalid file path Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/87cc336c Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/87cc336c Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/87cc336c Branch: refs/heads/master Commit: 87cc336cb59f8df559a201fdb1e2a6251b57a06b Parents: 1146c63 Author: Jesse MacFadyen <[email protected]> Authored: Thu Jul 11 15:59:31 2013 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Thu Jul 11 15:59:31 2013 -0700 ---------------------------------------------------------------------- build/packager.js | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/87cc336c/build/packager.js ---------------------------------------------------------------------- diff --git a/build/packager.js b/build/packager.js index 5026fbd..7e2f19b 100644 --- a/build/packager.js +++ b/build/packager.js @@ -188,28 +188,33 @@ function collectFiles(dir, id) { var result = {} - var entries = fs.readdirSync(dir) - - entries = entries.filter(function(entry) { - if (entry.match(/\.js$/)) return true - - var stat = fs.statSync(path.join(dir, entry)) - if (stat.isDirectory()) return true - }) + try { + var entries = fs.readdirSync(dir) + + entries = entries.filter(function(entry) { + if (entry.match(/\.js$/)) return true + + var stat = fs.statSync(path.join(dir, entry)) + if (stat.isDirectory()) return true + }) + + entries.forEach(function(entry) { + var moduleId = path.join(id, entry) + var fileName = path.join(dir, entry) + + var stat = fs.statSync(fileName) + if (stat.isDirectory()) { + copyProps(result, collectFiles(fileName, moduleId)) + } + else { + moduleId = getModuleId(moduleId) + result[moduleId] = fileName + } + }) + } + catch(ex) { - entries.forEach(function(entry) { - var moduleId = path.join(id, entry) - var fileName = path.join(dir, entry) - - var stat = fs.statSync(fileName) - if (stat.isDirectory()) { - copyProps(result, collectFiles(fileName, moduleId)) - } - else { - moduleId = getModuleId(moduleId) - result[moduleId] = fileName - } - }) + } return copyProps({}, result) }
