Skip to content

Commit

Permalink
🐛 Data sync may cause data loss on Android 14 siyuan-note/siyuan#10205
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jan 28, 2024
1 parent b3afd37 commit 4cf460a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,23 @@ func Walk(root string, fn filepath.WalkFunc) error {
infos = append(infos, info)
}

skipFiles := map[string]bool{}
for _, info := range infos {
p := info.Path()
skip := false
for skipFile, _ := range skipFiles {
if strings.HasPrefix(p, skipFile) {
skip = true
}
}
if skip {
continue
}

err = fn(p, info, nil)
if nil != err {
if errors.Is(err, fs.SkipDir) || errors.Is(err, fs.SkipAll) {
skipFiles[p] = true
continue
}

Expand Down

0 comments on commit 4cf460a

Please sign in to comment.