mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 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:
parent
89fe4fc560
commit
33216b093d
1 changed files with 13 additions and 11 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue