This commit is contained in:
Liang Ding 2022-10-12 09:15:06 +08:00
parent 5aa5764974
commit 3c4af0fc85
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 13 additions and 3 deletions

View file

@ -660,9 +660,13 @@ func clearWorkspaceTemp() {
logging.LogInfof("cleared workspace temp")
}
func LoadSnippets() (ret []*conf.Snippet) {
ret = []*conf.Snippet{}
var loadSnippetsLock = sync.Mutex{}
func LoadSnippets() (ret []*conf.Snippet, err error) {
loadSnippetsLock.Lock()
defer loadSnippetsLock.Unlock()
ret = []*conf.Snippet{}
confPath := filepath.Join(util.DataDir, "snippets/conf.json")
if !gulu.File.IsExist(confPath) {
return