Skip to content

Commit

Permalink
Changed fs wathcer to be recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
akclace committed Mar 2, 2024
1 parent 9ce5e1a commit 4aa30c2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net/http"
"os"
"path"
"path/filepath"
"sync"
"time"

Expand Down Expand Up @@ -326,10 +327,16 @@ func (a *App) startWatcher() error {
}()

// Add watcher path.
err = a.watcher.Add(a.SourceUrl)
if err != nil {
return err
}
filepath.WalkDir(a.SourceUrl, func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() {
a.Trace().Str("path", path).Msg("Adding path to watcher")
return a.watcher.Add(path)
}
return nil
})

return nil
}
Expand Down

0 comments on commit 4aa30c2

Please sign in to comment.