🎨 Prompt when the user attempts to create a workspace in the root directory of the disk https://github.com/siyuan-note/siyuan/issues/15976

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-09-29 11:34:24 +08:00
parent 89fe4fc560
commit 33216b093d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -52,17 +52,19 @@ func checkWorkspaceDir(c *gin.Context) {
} }
// 检查路径是否包含其他文件 // 检查路径是否包含其他文件
entries, err := os.ReadDir(path) if !util.IsWorkspaceDir(path) {
if err != nil { entries, err := os.ReadDir(path)
ret.Code = -1 if err != nil {
ret.Msg = fmt.Sprintf("read dir [%s] failed: %s", path, err) ret.Code = -1
return ret.Msg = fmt.Sprintf("read dir [%s] failed: %s", path, err)
} return
if 0 < len(entries) { }
ret.Code = -1 if 0 < len(entries) {
ret.Msg = model.Conf.Language(274) ret.Code = -1
ret.Data = map[string]interface{}{"closeTimeout": 7000} ret.Msg = model.Conf.Language(274)
return ret.Data = map[string]interface{}{"closeTimeout": 7000}
return
}
} }
if isInvalidWorkspacePath(path) { if isInvalidWorkspacePath(path) {