mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 Data sync may cause data loss on Android 14 https://github.com/siyuan-note/siyuan/issues/10205
This commit is contained in:
parent
dfe8f1317c
commit
c00dc1cc5c
13 changed files with 36 additions and 33 deletions
|
|
@ -28,6 +28,7 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
||||
|
|
@ -215,7 +216,7 @@ func IsSubPath(absPath, toCheckPath string) bool {
|
|||
}
|
||||
|
||||
func SizeOfDirectory(path string) (size int64, err error) {
|
||||
err = filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||
err = filelock.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||
if nil != err {
|
||||
return err
|
||||
}
|
||||
|
|
@ -234,7 +235,7 @@ func SizeOfDirectory(path string) (size int64, err error) {
|
|||
}
|
||||
|
||||
func DataSize() (dataSize, assetsSize int64) {
|
||||
filepath.Walk(DataDir, func(path string, info os.FileInfo, err error) error {
|
||||
filelock.Walk(DataDir, func(path string, info os.FileInfo, err error) error {
|
||||
if nil != err {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
|
|
@ -283,7 +284,7 @@ func WalkWithSymlinks(root string, fn filepath.WalkFunc) error {
|
|||
}
|
||||
|
||||
visitedDirs := make(map[string]struct{})
|
||||
return filepath.Walk(rr, getWalkFn(visitedDirs, fn))
|
||||
return filelock.Walk(rr, getWalkFn(visitedDirs, fn))
|
||||
}
|
||||
|
||||
func getWalkFn(visitedDirs map[string]struct{}, fn filepath.WalkFunc) filepath.WalkFunc {
|
||||
|
|
@ -319,7 +320,7 @@ func getWalkFn(visitedDirs map[string]struct{}, fn filepath.WalkFunc) filepath.W
|
|||
}
|
||||
|
||||
if ri.IsDir() {
|
||||
return filepath.Walk(rp, getWalkFn(visitedDirs, fn))
|
||||
return filelock.Walk(rp, getWalkFn(visitedDirs, fn))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue