mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 15:17:25 +00:00
Always continue walk in the face of errors (fixes #1)
This commit is contained in:
parent
4097528aa2
commit
9560265adc
15
walk.go
15
walk.go
@ -45,7 +45,8 @@ func tempName(name string, modified int64) string {
|
|||||||
func genWalker(base string, res *[]File, model *Model) filepath.WalkFunc {
|
func genWalker(base string, res *[]File, model *Model) filepath.WalkFunc {
|
||||||
return func(p string, info os.FileInfo, err error) error {
|
return func(p string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
warnln(err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if isTempName(p) {
|
if isTempName(p) {
|
||||||
@ -55,12 +56,14 @@ func genWalker(base string, res *[]File, model *Model) filepath.WalkFunc {
|
|||||||
if info.Mode()&os.ModeType == 0 {
|
if info.Mode()&os.ModeType == 0 {
|
||||||
rn, err := filepath.Rel(base, p)
|
rn, err := filepath.Rel(base, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
warnln(err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
fi, err := os.Stat(p)
|
fi, err := os.Stat(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
warnln(err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
modified := fi.ModTime().Unix()
|
modified := fi.ModTime().Unix()
|
||||||
|
|
||||||
@ -74,13 +77,15 @@ func genWalker(base string, res *[]File, model *Model) filepath.WalkFunc {
|
|||||||
}
|
}
|
||||||
fd, err := os.Open(p)
|
fd, err := os.Open(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
warnln(err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
|
|
||||||
blocks, err := Blocks(fd, BlockSize)
|
blocks, err := Blocks(fd, BlockSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
warnln(err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
f := File{
|
f := File{
|
||||||
Name: rn,
|
Name: rn,
|
||||||
|
Loading…
Reference in New Issue
Block a user