From 6c2ebe1eee60aa56c80e7d72c50a9cfbc196e414 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 30 Aug 2012 14:40:00 +0100 Subject: [PATCH] Fixed problem with node version number check --- core/boot.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/boot.js b/core/boot.js index d1bb75063..0a9a2179f 100644 --- a/core/boot.js +++ b/core/boot.js @@ -54,8 +54,13 @@ if(!$tw.browser) { $tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json")); // Check node version number var targetVersion = $tw.packageInfo.engine.node.substr(2).split("."), - currVersion = process.version.substr(1).split("."); - if(parseInt(targetVersion[0],10) > parseInt(currVersion[0],10) || parseInt(targetVersion[1],10) > parseInt(currVersion[1],10) || parseInt(targetVersion[2],10) > parseInt(currVersion[2],10)) { + currVersion = process.version.substr(1).split("."), + diff = [parseInt(targetVersion[0],10) - parseInt(currVersion[0],10), + parseInt(targetVersion[1],10) - parseInt(currVersion[1],10), + parseInt(targetVersion[2],10) - parseInt(currVersion[2],10)]; + if((diff[0] > 0) || + (diff[0] === 0 && diff[1] > 0) || + (diff[0] === 0 && diff[1] === 0 && diff[2] > 0)) { throw "TiddlyWiki5 requires node.js version " + $tw.packageInfo.engine.node; } }