From 0a9987726a8d25586d69234bec54b79ba7bc1a1e Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 12 Aug 2022 11:41:03 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=20Windows=20?= =?UTF-8?q?=E7=AB=AF=E9=BB=98=E8=AE=A4=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=20Fix=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/5622?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/util/working.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/util/working.go b/kernel/util/working.go index f5c99990c..c72cafcc6 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -194,6 +194,13 @@ func initWorkspaceDir(workspaceArg string) { } defaultWorkspaceDir := filepath.Join(HomeDir, "Documents", "SiYuan") + if gulu.OS.IsWindows() { + // 改进 Windows 端默认工作空间路径 https://github.com/siyuan-note/siyuan/issues/5622 + if userProfile := os.Getenv("USERPROFILE"); "" != userProfile { + defaultWorkspaceDir = filepath.Join(userProfile, "Documents", "SiYuan") + } + } + var workspacePaths []string if !gulu.File.IsExist(workspaceConf) { WorkspaceDir = defaultWorkspaceDir