🐛 删除文档后应关闭该文档的关系图、大纲和反链页签 https://github.com/siyuan-note/siyuan/issues/6468

This commit is contained in:
Liang Ding 2022-11-03 19:55:48 +08:00
parent 262e8b3022
commit 0e651b097f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 29 additions and 7 deletions

View file

@ -202,3 +202,22 @@ func FilterSelfChildDocs(paths []string) (ret []string) {
}
return
}
func GetChildDocIDs(parentDocDirAbsPath string) (ret []string) {
if !gulu.File.IsDir(parentDocDirAbsPath) {
return
}
filepath.Walk(parentDocDirAbsPath, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil
}
if !strings.HasSuffix(path, ".sy") {
return nil
}
id := path[len(parentDocDirAbsPath)+1 : len(path)-3]
ret = append(ret, id)
return nil
})
return
}