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 err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = fmt.Sprintf("read dir [%s] failed: %s", path, err)
|
||||
return
|
||||
}
|
||||
if 0 < len(entries) {
|
||||
ret.Code = -1
|
||||
ret.Msg = model.Conf.Language(274)
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
if !util.IsWorkspaceDir(path) {
|
||||
entries, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = fmt.Sprintf("read dir [%s] failed: %s", path, err)
|
||||
return
|
||||
}
|
||||
if 0 < len(entries) {
|
||||
ret.Code = -1
|
||||
ret.Msg = model.Conf.Language(274)
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if isInvalidWorkspacePath(path) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue