mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🐛 设置代码片段报错 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
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|
@ -66,7 +67,7 @@ func LoadSnippets() (ret []*conf.Snippet, err error) {
|
||||||
|
|
||||||
func loadSnippets() (ret []*conf.Snippet, err error) {
|
func loadSnippets() (ret []*conf.Snippet, err error) {
|
||||||
ret = []*conf.Snippet{}
|
ret = []*conf.Snippet{}
|
||||||
confPath := filepath.Join(util.DataDir, "snippets/conf.json")
|
confPath := filepath.Join(util.SnippetsPath, "conf.json")
|
||||||
if !gulu.File.IsExist(confPath) {
|
if !gulu.File.IsExist(confPath) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +103,11 @@ func writeSnippetsConf(snippets []*conf.Snippet) (err error) {
|
||||||
return
|
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)
|
err = filelock.WriteFile(confPath, data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue