Commit with fixed paths

This commit is contained in:
2022-02-10 03:46:44 +01:00
parent 44ef9ad3bf
commit b0956ac5d1
51 changed files with 2450 additions and 1 deletions

31
index.js Normal file
View File

@@ -0,0 +1,31 @@
if (process.platform !== `win32`) {
throw `node-simconnect: The only supported platform is Windows (win32). Found: ${process.platform}`;
}
let nodeSimconnect = undefined;
try {
const TEXT_COLOR = '\x1b[30m\x1b[44m%s\x1b[0m';
// Try loading manual build first
try {
nodeSimconnect = require(`./build/Release/node_simconnect`);
console.info(TEXT_COLOR, `node-simconnect: Local Debug build loaded`);
} catch {
nodeSimconnect = require(`./build/Debug/node_simconnect`);
console.info(TEXT_COLOR, `node-simconnect: Local Release build loaded`);
}
} catch (ex) {
// If it fails, load the included binary
console.info(`node-simconnect: Failed to load manual build (${ex.code})`);
console.info(`node-simconnect: Loading pre-built binary`);
if (process.arch === `x64`) {
throw `node-simconnect: The pre-built binary only works with the 32-bit version of Node.js`;
}
nodeSimconnect = require(`./bin/win_ia32/node_simconnect`);
console.info(`node-simconnect: Pre-built binary loaded`);
}
module.exports = {
SimConnect: nodeSimconnect.SimConnect,
...require("./src/generated/constants")
};