fix(electron): plugin cannot found (#3418)

This commit is contained in:
Alex Yang authored and GitHub committed 2023-07-27 19:55:19 +00:00
1 parent e1f604d857
commit d2459a5837
1 file changed
+3 -1
+3 -1
View File
@@ -15,7 +15,7 @@ protocol.registerSchemesAsPrivileged([
]); ]);
function toAbsolutePath(url: string) { function toAbsolutePath(url: string) {
let realpath = decodeURIComponent(url); let realpath: string;
const webStaticDir = join(__dirname, '../resources/web-static'); const webStaticDir = join(__dirname, '../resources/web-static');
if (url.startsWith('./')) { if (url.startsWith('./')) {
// if is a file type, load the file in resources // if is a file type, load the file in resources
@@ -25,6 +25,8 @@ function toAbsolutePath(url: string) {
// else, fallback to load the index.html instead // else, fallback to load the index.html instead
realpath = join(webStaticDir, 'index.html'); realpath = join(webStaticDir, 'index.html');
} }
} else {
realpath = join(webStaticDir, decodeURIComponent(url));
} }
return realpath; return realpath;
} }