diff --git a/regolith/filter.go b/regolith/filter.go index 4b9b53d..95a435d 100644 --- a/regolith/filter.go +++ b/regolith/filter.go @@ -61,18 +61,7 @@ func (c *RunContext) StartWatchingSourceFiles() error { c.interruption = make(chan string) c.fileWatchingError = make(chan error) c.fileWatchingStage = make(chan string) - - var roots []string - if c.Config.ResourceFolder != "" { - roots = append(roots, c.Config.ResourceFolder) - } - if c.Config.BehaviorFolder != "" { - roots = append(roots, c.Config.BehaviorFolder) - } - if c.Config.DataPath != "" { - roots = append(roots, c.Config.DataPath) - } - err := NewDirWatcher(roots, c.Config, c.interruption, c.fileWatchingError, c.fileWatchingStage) + err := NewDirWatcher(c.Config, c.interruption, c.fileWatchingError, c.fileWatchingStage) if err != nil { return err } diff --git a/regolith/watcher.go b/regolith/watcher.go index 9c58f9d..0fdd2bf 100644 --- a/regolith/watcher.go +++ b/regolith/watcher.go @@ -27,12 +27,21 @@ type DirWatcher struct { } func NewDirWatcher( - roots []string, config *Config, interruption chan string, errors chan error, stage <-chan string, ) error { + var roots []string + if config.ResourceFolder != "" { + roots = append(roots, config.ResourceFolder) + } + if config.BehaviorFolder != "" { + roots = append(roots, config.BehaviorFolder) + } + if config.DataPath != "" { + roots = append(roots, config.DataPath) + } d := &DirWatcher{ roots: roots, config: config,