lib/fs, lib/model: Add error channel to Watch to avoid panics (fixes #5697) (#5734)

* lib/fs, lib/model: Add error channel to Watch to avoid panics (fixes #5697)

* forgot unsupported watch

* and more non(-standard)-unixy fixes

* and windows test

* review
This commit is contained in:
Simon Frei
2019-05-25 21:08:26 +02:00
committed by Audrius Butkevicius
parent 9e6db72535
commit 486230768e
12 changed files with 158 additions and 105 deletions

View File

@@ -8,6 +8,7 @@ package fs
import (
"errors"
"fmt"
"os"
"path/filepath"
"runtime"
@@ -334,3 +335,13 @@ func longFilenameSupport(path string) string {
}
return path
}
type ErrWatchEventOutsideRoot struct{ msg string }
func (e *ErrWatchEventOutsideRoot) Error() string {
return e.msg
}
func (f *BasicFilesystem) newErrWatchEventOutsideRoot(absPath, root string) *ErrWatchEventOutsideRoot {
return &ErrWatchEventOutsideRoot{fmt.Sprintf("Watching for changes encountered an event outside of the filesystem root: f.root==%v, root==%v, path==%v. This should never happen, please report this message to forum.syncthing.net.", f.root, root, absPath)}
}