There was an error while loading. Please reload this page.
1 parent 211cfe9 commit 1e9b4c3Copy full SHA for 1e9b4c3
1 file changed
app/electron/main.js
@@ -71,7 +71,18 @@ if (!app.requestSingleInstanceLock()) {
71
return;
72
}
73
74
-app.setAsDefaultProtocolClient("siyuan");
+// 开发环境下 Windows 需显式传入 Electron 可执行文件路径和 main.js 路径,否则 siyuan:// 会被当作相对路径
75
+if (isDevEnv && process.defaultApp && process.argv.length >= 2) {
76
+ const mainScript = path.resolve(process.argv[1]);
77
+ if (process.platform === "win32") {
78
+ app.removeAsDefaultProtocolClient("siyuan", process.execPath, [mainScript]);
79
+ app.setAsDefaultProtocolClient("siyuan", process.execPath, [mainScript]);
80
+ } else {
81
+ app.setAsDefaultProtocolClient("siyuan");
82
+ }
83
+} else {
84
85
+}
86
87
app.commandLine.appendSwitch("disable-web-security");
88
app.commandLine.appendSwitch("auto-detect", "false");
0 commit comments