Skip to content

Commit

Permalink
🎨 桌面端支持同时打开多个工作空间 #4567
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jan 6, 2023
1 parent cdc8f41 commit 3131281
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions app/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ try {
}
} catch (e) {
console.error(e)
require('electron').
dialog.
showErrorBox('创建配置目录失败 Failed to create config directory',
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
require('electron').dialog.showErrorBox('创建配置目录失败 Failed to create config directory',
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
app.exit()
}

Expand Down Expand Up @@ -416,6 +414,8 @@ const initKernel = (workspace, lang) => {
}
if (workspace) {
cmds.push('--workspace', workspace)
}
if (lang) {
cmds.push('--lang', lang)
}
let cmd = `ui version [${appVer}], booting kernel [${kernelPath} ${cmds.join(
Expand Down Expand Up @@ -826,7 +826,19 @@ app.whenReady().then(() => {
firstOpenWindow.destroy()
})
} else {
initKernel().then((isSucc) => {
const getArg = (name) => {
for (let i = 0; i < process.argv.length; i++) {
if (process.argv[i] === name) {
return process.argv[i + 1]
}
}
}

const workspace = getArg("--workspace")
if (workspace) {
writeLog("got arg [--workspace=" + workspace + "]")
}
initKernel(workspace).then((isSucc) => {
if (isSucc) {
boot()
}
Expand Down

0 comments on commit 3131281

Please sign in to comment.