Skip to content

Commit

Permalink
Handle setting roots up internally in DirWatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
arexon committed Oct 14, 2024
1 parent 7e61890 commit 524aa99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 1 addition & 12 deletions regolith/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 10 additions & 1 deletion regolith/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 524aa99

Please sign in to comment.