Fixed native module load

This commit is contained in:
WolverinDEV 2020-04-04 14:27:42 +02:00
parent ad949033f4
commit ac9b91fe5c
1 changed files with 7 additions and 1 deletions

View File

@ -79,7 +79,13 @@ overrides.push({
throw "unknown native module";
const app_path = (remote || electron).app.getAppPath();
const target_path = path.join(app_path, "native", "build", os.platform() + "_" + os.arch(), file_mapping[name]);
let target_path;
if(app_path.endsWith(".asar")) {
target_path = path.join(path.dirname(app_path), "native", file_mapping[name]);
} else {
/* from source code */
target_path = path.join(app_path, "native", "build", os.platform() + "_" + os.arch(), file_mapping[name]);
}
return require(target_path);
}
});