🐛 设置代码片段报错 Fix https://github.com/siyuan-note/siyuan/issues/6382
This commit is contained in:
parent
53d96adac2
commit
b194f803d5
1 changed files with 7 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
|
@ -66,7 +67,7 @@ func LoadSnippets() (ret []*conf.Snippet, err error) {
|
|||
|
||||
func loadSnippets() (ret []*conf.Snippet, err error) {
|
||||
ret = []*conf.Snippet{}
|
||||
confPath := filepath.Join(util.DataDir, "snippets/conf.json")
|
||||
confPath := filepath.Join(util.SnippetsPath, "conf.json")
|
||||
if !gulu.File.IsExist(confPath) {
|
||||
return
|
||||
}
|
||||
|
@ -102,7 +103,11 @@ func writeSnippetsConf(snippets []*conf.Snippet) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
confPath := filepath.Join(util.DataDir, "snippets/conf.json")
|
||||
if err = os.MkdirAll(util.SnippetsPath, 0755); nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
confPath := filepath.Join(util.SnippetsPath, "conf.json")
|
||||
err = filelock.WriteFile(confPath, data)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue