forked from microsoft/napajs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaths.js
47 lines (42 loc) · 1.49 KB
/
paths.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
let path = require('path');
Object.defineProperty(exports, 'root', {
get: function() {
let rootPath = path.resolve(__dirname, '..');
// Output the path to stdout for cmake/gyp commands.
process.stdout.write(rootPath);
return rootPath;
}
});
Object.defineProperty(exports, 'lib', {
get: function() {
let libPath = path.resolve(__dirname, '../bin/' + getLibraryName('napa'));
// Output the path to stdout for cmake/gyp commands.
process.stdout.write(libPath);
return libPath;
}
});
Object.defineProperty(exports, 'inc', {
get: function() {
let incPath = path.resolve(__dirname, '../inc');
// Output the path to stdout for cmake/gyp commands.
process.stdout.write(incPath);
return incPath;
}
});
// Resolve library name according to platform type.
function getLibraryName(originalName) {
if (process.platform === "win32") {
return originalName + '.lib';
} else if (process.platform === 'darwin') {
return 'lib' + originalName + '.dylib';
} else if (process.platform === 'linux') {
return 'lib' + originalName + '.so';
} else {
throw new Error(
'Failed to resolve the library name of "' + originalName +
'" because your platform type "' + process.platform +
'"is not supported by require(\'napajs/build\').paths');
}
}