From ca37685d086d92580abc12d85805a5a1eb717114 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Oct 2023 17:28:19 +0800 Subject: [PATCH] :art: Upgrade kernel dpes --- kernel/go.mod | 2 +- kernel/go.sum | 8 ++------ kernel/model/box.go | 2 +- kernel/model/file.go | 4 ++-- kernel/model/import.go | 4 ++-- kernel/model/transaction.go | 2 +- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/kernel/go.mod b/kernel/go.mod index 566606612..2eac1c725 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -50,7 +50,7 @@ require ( github.com/siyuan-note/dejavu v0.0.0-20231030071534-4dce9cc8d9af github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 - github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 + github.com/siyuan-note/filelock v0.0.0-20231030092426-0ff158f5f8ca github.com/siyuan-note/httpclient v0.0.0-20231028070852-3c2c5a151c13 github.com/siyuan-note/logging v0.0.0-20231030034701-8265764f00ff github.com/siyuan-note/riff v0.0.0-20230928143458-ffd178c7e0fc diff --git a/kernel/go.sum b/kernel/go.sum index c3937bdfe..ccb44cb0b 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -338,18 +338,14 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8= -github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f h1:qcnlaDdl74QBBJcTts4g46Fjoo2bftHQZe63DN91/lc= -github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= -github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa h1:jNdF6vITlStzrVaJVT05hsT5ItZiJWlAbQt2hJu+E8A= -github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= github.com/siyuan-note/dejavu v0.0.0-20231030071534-4dce9cc8d9af h1:C2vF0KJUODTW9Q06NcmP2zPfTDz0plOyDRoIAePKZD4= github.com/siyuan-note/dejavu v0.0.0-20231030071534-4dce9cc8d9af/go.mod h1:l/akstKweKTdzTZ3FxFH2d49ekEbs9dAFmzDiM7tBik= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8= github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI= -github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 h1:ZuxN5gwqtUOd1NkOkNhM4OlVWfjujY98zsR+zFi4x9g= -github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524/go.mod h1:jK5lCYfPbFOrW23/HMeU7kmpLdEd5GkennF+kUpy7Vs= +github.com/siyuan-note/filelock v0.0.0-20231030092426-0ff158f5f8ca h1:e0+lU1gxFXV+SOjuce4H2QH9VNfAibXbPyuU+dlC4wk= +github.com/siyuan-note/filelock v0.0.0-20231030092426-0ff158f5f8ca/go.mod h1:H735iw2ycTmG31yNWu4/zEzFtYUSTTcY3DPEV8y98IQ= github.com/siyuan-note/httpclient v0.0.0-20231028070852-3c2c5a151c13 h1:DQwiRQa63wsjSKQN5TvTWI2Dd5XSulhnXvxIdOG8/x8= github.com/siyuan-note/httpclient v0.0.0-20231028070852-3c2c5a151c13/go.mod h1:mS0nX5fX99R/5HLnKqG40kpbathSCXxL/oxe88rURNI= github.com/siyuan-note/logging v0.0.0-20231030034701-8265764f00ff h1:5GcxrTOJTsusXOLhg4GuHWbEa4M5gu+CNfL0giwNjDM= diff --git a/kernel/model/box.go b/kernel/model/box.go index ca1504481..f43010af2 100644 --- a/kernel/model/box.go +++ b/kernel/model/box.go @@ -333,7 +333,7 @@ func (box *Box) Move(oldPath, newPath string) error { fromPath := filepath.Join(boxLocalPath, oldPath) toPath := filepath.Join(boxLocalPath, newPath) - if err := filelock.Move(fromPath, toPath); nil != err { + if err := filelock.Rename(fromPath, toPath); nil != err { msg := fmt.Sprintf(Conf.Language(5), box.Name, fromPath, err) logging.LogErrorf("move [path=%s] in box [%s] failed: %s", fromPath, box.Name, err) return errors.New(msg) diff --git a/kernel/model/file.go b/kernel/model/file.go index 15d29c4ae..59cc79ecf 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1208,7 +1208,7 @@ func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngin if gulu.File.IsExist(absToPath) { filelock.Remove(absToPath) } - if err = filelock.Move(absFromPath, absToPath); nil != err { + if err = filelock.Rename(absFromPath, absToPath); nil != err { msg := fmt.Sprintf(Conf.Language(5), fromBox.Name, fromPath, err) logging.LogErrorf("move [path=%s] in box [%s] failed: %s", fromPath, fromBox.ID, err) err = errors.New(msg) @@ -1233,7 +1233,7 @@ func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngin } else { absFromPath := filepath.Join(util.DataDir, fromBox.ID, fromPath) absToPath := filepath.Join(util.DataDir, toBox.ID, newPath) - if err = filelock.Move(absFromPath, absToPath); nil != err { + if err = filelock.Rename(absFromPath, absToPath); nil != err { msg := fmt.Sprintf(Conf.Language(5), fromBox.Name, fromPath, err) logging.LogErrorf("move [path=%s] in box [%s] failed: %s", fromPath, fromBox.ID, err) err = errors.New(msg) diff --git a/kernel/model/import.go b/kernel/model/import.go index ec6f9c198..12028a0ff 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -337,7 +337,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { return } newSyPath := filepath.Join(filepath.Dir(syPath), tree.ID+".sy") - if err = filelock.Move(syPath, newSyPath); nil != err { + if err = filelock.Rename(syPath, newSyPath); nil != err { logging.LogErrorf("rename .sy from [%s] to [%s] failed: %s", syPath, newSyPath, err) return } @@ -437,7 +437,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { }) for i, oldPath := range oldPaths { newPath := renamePaths[oldPath] - if err = filelock.Move(oldPath, newPath); nil != err { + if err = filelock.Rename(oldPath, newPath); nil != err { logging.LogErrorf("rename path from [%s] to [%s] failed: %s", oldPath, renamePaths[oldPath], err) return errors.New("rename path failed") } diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 24608eacc..71c205632 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -799,7 +799,7 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) { // 只有全局 assets 才移动到相对 assets targetP := filepath.Join(assets, filepath.Base(assetPath)) - if e = filelock.Move(assetPath, targetP); nil != err { + if e = filelock.Rename(assetPath, targetP); nil != err { logging.LogErrorf("copy path of asset from [%s] to [%s] failed: %s", assetPath, targetP, err) return ast.WalkContinue }