mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 05:52:31 +02:00
use path join for platform agnostic absolute path
This commit is contained in:
parent
f569ebb0a9
commit
39e95837ec
1 changed files with 7 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
exports.searchPaths = function(name, binaryType) {
|
exports.searchPaths = function(name, binaryType) {
|
||||||
function platformExtension(name) {
|
function platformExtension(name) {
|
||||||
|
@ -29,7 +30,7 @@ exports.searchPaths = function(name, binaryType) {
|
||||||
} else {
|
} else {
|
||||||
// check directly beside the binary
|
// check directly beside the binary
|
||||||
paths = [
|
paths = [
|
||||||
process.execPath + "/" + name + extension,
|
path.join(process.execPath, name + extension)
|
||||||
];
|
];
|
||||||
|
|
||||||
// check if we're inside an app bundle on OS X
|
// 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) {
|
exports.discoveredPath = function (name, binaryType) {
|
||||||
function binaryFromPaths(name, paths) {
|
function binaryFromPaths(name, paths) {
|
||||||
for (var i = 0; i < paths.length; i++) {
|
for (var i = 0; i < paths.length; i++) {
|
||||||
var path = paths[i];
|
var testPath = paths[i];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var stats = fs.lstatSync(path);
|
var stats = fs.lstatSync(testPath);
|
||||||
|
|
||||||
if (stats.isFile() || (stats.isDirectory() && extension == ".app")) {
|
if (stats.isFile() || (stats.isDirectory() && extension == ".app")) {
|
||||||
console.log("Found " + name + " at " + path);
|
console.log("Found " + name + " at " + testPath);
|
||||||
return path;
|
return testPath;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Executable with name " + name + " not found at path " + path);
|
console.log("Executable with name " + name + " not found at path " + testPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue