From 4aa30c2f09d8e0af5da77b1d500b963bdc5d56b8 Mon Sep 17 00:00:00 2001 From: Ajay Kidave Date: Sat, 2 Mar 2024 11:59:46 -0800 Subject: [PATCH] Changed fs wathcer to be recursive --- internal/app/app.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index 0442fff..a281963 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -12,6 +12,7 @@ import ( "net/http" "os" "path" + "path/filepath" "sync" "time" @@ -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 }