Fixed native module load
This commit is contained in:
parent
ad949033f4
commit
ac9b91fe5c
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue