From 39e95837ec32ed8a199b773c809e06190d75e6b2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 7 Jan 2016 17:44:55 -0800 Subject: [PATCH] use path join for platform agnostic absolute path --- console/src/modules/path-finder.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/console/src/modules/path-finder.js b/console/src/modules/path-finder.js index e3dd118537..e126af1358 100644 --- a/console/src/modules/path-finder.js +++ b/console/src/modules/path-finder.js @@ -1,4 +1,5 @@ var fs = require('fs'); +var path = require('path'); exports.searchPaths = function(name, binaryType) { function platformExtension(name) { @@ -29,7 +30,7 @@ exports.searchPaths = function(name, binaryType) { } else { // check directly beside the binary paths = [ - process.execPath + "/" + name + extension, + path.join(process.execPath, name + extension) ]; // check if we're inside an app bundle on OS X @@ -53,17 +54,17 @@ exports.searchPaths = function(name, binaryType) { exports.discoveredPath = function (name, binaryType) { function binaryFromPaths(name, paths) { for (var i = 0; i < paths.length; i++) { - var path = paths[i]; + var testPath = paths[i]; try { - var stats = fs.lstatSync(path); + var stats = fs.lstatSync(testPath); if (stats.isFile() || (stats.isDirectory() && extension == ".app")) { - console.log("Found " + name + " at " + path); - return path; + console.log("Found " + name + " at " + testPath); + return testPath; } } catch (e) { - console.log("Executable with name " + name + " not found at path " + path); + console.log("Executable with name " + name + " not found at path " + testPath); } }