From d5f2255a68f16fd5dd90d2c47955e06957de5569 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 6 Dec 2015 23:29:58 +0000 Subject: [PATCH] Handle null coreNodesPath --- red/runtime/index.js | 4 ++- red/runtime/nodes/registry/localfilesystem.js | 26 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/red/runtime/index.js b/red/runtime/index.js index b93db1d6d..47553ee07 100644 --- a/red/runtime/index.js +++ b/red/runtime/index.js @@ -136,7 +136,9 @@ function start() { redNodes.cleanModuleList(); } } - log.info(log._("runtime.paths.settings",{path:settings.settingsFile})); + if (settings.settingsFile) { + log.info(log._("runtime.paths.settings",{path:settings.settingsFile})); + } redNodes.loadFlows().then(redNodes.startFlows); }).otherwise(function(err) { console.log(err); diff --git a/red/runtime/nodes/registry/localfilesystem.js b/red/runtime/nodes/registry/localfilesystem.js index 59560deaf..503e1ea66 100644 --- a/red/runtime/nodes/registry/localfilesystem.js +++ b/red/runtime/nodes/registry/localfilesystem.js @@ -140,14 +140,16 @@ function scanTreeForNodesModules(moduleName) { results = results.concat(scanDirForNodesModules(userDir,moduleName)); } - var up = path.resolve(path.join(dir,"..")); - while (up !== dir) { - var pm = path.join(dir,"node_modules"); - if (pm != userDir) { - results = results.concat(scanDirForNodesModules(pm,moduleName)); + if (dir) { + var up = path.resolve(path.join(dir,"..")); + while (up !== dir) { + var pm = path.join(dir,"node_modules"); + if (pm != userDir) { + results = results.concat(scanDirForNodesModules(pm,moduleName)); + } + dir = up; + up = path.resolve(path.join(dir,"..")); } - dir = up; - up = path.resolve(path.join(dir,"..")); } return results; } @@ -188,11 +190,13 @@ function getModuleNodeFiles(module) { function getNodeFiles(disableNodePathScan) { var dir; // Find all of the nodes to load - var nodeFiles = getLocalNodeFiles(path.resolve(settings.coreNodesDir)); - //console.log(nodeFiles); + var nodeFiles = []; - var defaultLocalesPath = path.resolve(path.join(settings.coreNodesDir,"core","locales")); - i18n.registerMessageCatalog("node-red",defaultLocalesPath,"messages.json"); + if (settings.coreNodesDir) { + nodeFiles = getLocalNodeFiles(path.resolve(settings.coreNodesDir)); + var defaultLocalesPath = path.resolve(path.join(settings.coreNodesDir,"core","locales")); + i18n.registerMessageCatalog("node-red",defaultLocalesPath,"messages.json"); + } if (settings.userDir) { dir = path.join(settings.userDir,"nodes");