An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: 多个桌面端快捷方式指定不同的 `--workspace` 参数后无法启动多个工作空间 https://github.com/siyuan-note/siyuan/issues/7059
Liang Dingd7577ffb61c7
diff --git a/kernel/util/working.go b/kernel/util/working.goindex d0136e2792..f49a8accc5 100644--- a/kernel/util/working.go+++ b/kernel/util/working.go@@ -212,36 +212,26 @@ func initWorkspaceDir(workspaceArg string) {if "" != workspaceArg {WorkspaceDir = workspaceArg}- if !gulu.File.IsDir(WorkspaceDir) {- log.Printf("use the default workspace [%s] since the specified workspace [%s] is not a dir", defaultWorkspaceDir, WorkspaceDir)- WorkspaceDir = defaultWorkspaceDir- }- workspacePaths = append(workspacePaths, WorkspaceDir)} else {workspacePaths, _ = ReadWorkspacePaths()if 0 < len(workspacePaths) {+ // 取最后一个(也就是最近打开的)工作空间WorkspaceDir = workspacePaths[len(workspacePaths)-1]- if "" != workspaceArg {- WorkspaceDir = workspaceArg- }- if !gulu.File.IsDir(WorkspaceDir) {- log.Printf("use the default workspace [%s] since the specified workspace [%s] is not a dir", WorkspaceDir, defaultWorkspaceDir)- WorkspaceDir = defaultWorkspaceDir- }- workspacePaths[len(workspacePaths)-1] = WorkspaceDir} else {WorkspaceDir = defaultWorkspaceDir- if "" != workspaceArg {- WorkspaceDir = workspaceArg- }- if !gulu.File.IsDir(WorkspaceDir) {- log.Printf("use the default workspace [%s] since the specified workspace [%s] is not a dir", WorkspaceDir, defaultWorkspaceDir)- WorkspaceDir = defaultWorkspaceDir- }- workspacePaths = append(workspacePaths, WorkspaceDir)+ }++ if "" != workspaceArg {+ WorkspaceDir = workspaceArg}}+ if !gulu.File.IsDir(WorkspaceDir) {+ log.Printf("use the default workspace [%s] since the specified workspace [%s] is not a dir", WorkspaceDir, defaultWorkspaceDir)+ WorkspaceDir = defaultWorkspaceDir+ }+ workspacePaths = append(workspacePaths, WorkspaceDir)+if err := WriteWorkspacePaths(workspacePaths); nil != err {log.Fatalf("write workspace conf [%s] failed: %s", workspaceConf, err)}@@ -284,8 +274,6 @@ func ReadWorkspacePaths() (ret []string, err error) {return}- ret = gulu.Str.RemoveDuplicatedElem(ret)-var tmp []stringfor _, d := range ret {d = strings.TrimRight(d, " \t\n") // 去掉工作空间路径尾部空格 https://github.com/siyuan-note/siyuan/issues/6353@@ -294,6 +282,7 @@ func ReadWorkspacePaths() (ret []string, err error) {}}ret = tmp+ ret = gulu.Str.RemoveDuplicatedElem(ret)return}