*Bug fix path loading

*Ensure process.pkg is unset as it causes loady to behave differently, and we do not need it
This commit is contained in:
Derrick Hammer 2022-12-14 13:48:11 -05:00
parent 1943684006
commit e3199939b0
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 2 deletions

View File

@ -10,13 +10,18 @@ const loaderFunction = `function loadNativeModuleTemp(module, data) {
const tempDir = require("os").tmpdir();
const fs = require("fs");
const path = require("path");
const outputPath = path.join(tempDir, module, "build", "Release");
const loadPath = path.join(tempDir, module);
const outputPath = path.join(loadPath, "build", "Release");
const modulePath = path.join(outputPath, module + ".node");
fs.mkdirSync(outputPath, { recursive: true });
fs.writeFileSync(modulePath, Buffer.from(data, "base64"));
return modulePath;
if (process.pkg) {
process.pkg = undefined;
}
return loadPath;
}`;
type Edit = [number, number];