From 738a53f43e2203310678e6f8fd4b666641a278f1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 12 Nov 2024 17:23:53 +0800 Subject: [PATCH] :art: Improve code snippet writing https://github.com/siyuan-note/siyuan/issues/13101 --- kernel/model/snippet.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/model/snippet.go b/kernel/model/snippet.go index 98449bd45..b1484bf12 100644 --- a/kernel/model/snippet.go +++ b/kernel/model/snippet.go @@ -108,6 +108,10 @@ func writeSnippetsConf(snippets []*conf.Snippet) (err error) { } confPath := filepath.Join(util.SnippetsPath, "conf.json") + oldData, _ := filelock.ReadFile(confPath) + if string(oldData) == string(data) { + return + } err = filelock.WriteFile(confPath, data) return }