WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 249f9bb

Browse files
committed
Update loader script
1 parent 4726a22 commit 249f9bb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

frontend/modules/installer.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,17 @@ const files = [
8383
{
8484
name: "index.js",
8585
content() {
86-
return `const path=require("path");require(path.join(require(path.join(__dirname,"package.json")).location,"kernel.asar"))?.default?.({startOriginal: true});`;
86+
return `const pkg = require("./package.json");
87+
const Module = require("module");
88+
const path = require("path");
89+
90+
try {
91+
const kernel = require(path.join(pkg.location, "kernel.asar"));
92+
if (kernel?.default) kernel.default({ startOriginal: true });
93+
} catch(e) {
94+
console.error("Kernel failed to load: ", e.message);
95+
Module._load(path.join(__dirname, "..", "app-original.asar"), null, true);
96+
}`;
8797
}
8898
},
8999
{

0 commit comments

Comments
 (0)