diff --git a/pkg/watch/ospath.go b/pkg/watch/ospath.go deleted file mode 100644 index 2243914e3..000000000 --- a/pkg/watch/ospath.go +++ /dev/null @@ -1,8 +0,0 @@ -package watch - -import "github.com/windmilleng/tilt/internal/ospath" - -func pathIsChildOf(path string, parent string) bool { - _, isChild := ospath.Child(parent, path) - return isChild -} diff --git a/pkg/watch/watcher_darwin.go b/pkg/watch/watcher_darwin.go index eb5d472ba..c233cd9a0 100644 --- a/pkg/watch/watcher_darwin.go +++ b/pkg/watch/watcher_darwin.go @@ -5,6 +5,8 @@ import ( "sync" "time" + "github.com/windmilleng/tilt/internal/ospath" + "github.com/windmilleng/fsevents" ) @@ -77,8 +79,7 @@ func (d *darwinNotify) Add(name string) error { // Check if this is a subdirectory of any of the paths // we're already watching. for _, parent := range es.Paths { - isChild := pathIsChildOf(name, parent) - if isChild { + if ospath.IsChild(parent, name) { return nil } } diff --git a/pkg/watch/watcher_naive.go b/pkg/watch/watcher_naive.go index 564595191..bb240c9ba 100644 --- a/pkg/watch/watcher_naive.go +++ b/pkg/watch/watcher_naive.go @@ -10,6 +10,8 @@ import ( "github.com/pkg/errors" "github.com/windmilleng/fsnotify" + + "github.com/windmilleng/tilt/internal/ospath" ) // A naive file watcher that uses the plain fsnotify API. @@ -151,7 +153,7 @@ func (d *naiveNotify) shouldNotify(e fsnotify.Event) bool { } else { // TODO(dmiller): maybe use a prefix tree here? for path := range d.notifyList { - if pathIsChildOf(e.Name, path) { + if ospath.IsChild(path, e.Name) { return true } }