🎨 改进写入工作空间路径配置

This commit is contained in:
Liang Ding 2023-03-23 19:32:11 +08:00
parent 984615fbc1
commit 1630cec5b1
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -35,6 +35,7 @@ import (
"github.com/88250/gulu" "github.com/88250/gulu"
figure "github.com/common-nighthawk/go-figure" figure "github.com/common-nighthawk/go-figure"
"github.com/gofrs/flock" "github.com/gofrs/flock"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/httpclient" "github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging" "github.com/siyuan-note/logging"
) )
@ -295,7 +296,7 @@ func WriteWorkspacePaths(workspacePaths []string) (err error) {
return return
} }
if err = os.WriteFile(workspaceConf, data, 0644); nil != err { if err = filelock.WriteFile(workspaceConf, data); nil != err {
msg := fmt.Sprintf("write workspace conf [%s] failed: %s", workspaceConf, err) msg := fmt.Sprintf("write workspace conf [%s] failed: %s", workspaceConf, err)
logging.LogErrorf(msg) logging.LogErrorf(msg)
err = errors.New(msg) err = errors.New(msg)