diff --git a/internal/tagger/detectApp.go b/internal/tagger/detectApp.go index 621e20c..d3d797d 100644 --- a/internal/tagger/detectApp.go +++ b/internal/tagger/detectApp.go @@ -51,6 +51,7 @@ func (t *AppTagger) EventMatch(s string) bool { return strings.Contains(s, "apps") } +// FIXME: Only process the file that caused the event func (t *AppTagger) EventCallback() { files, err := os.ReadDir(appPath) if err != nil { @@ -85,6 +86,7 @@ func (t *AppTagger) Register() error { } if util.CheckFileExists(appPath) { + t.EventCallback() log.Infof("Setup file watch for %s", appPath) util.AddListener(appPath, t) } diff --git a/internal/util/fswatcher.go b/internal/util/fswatcher.go index aaf3372..5d13462 100644 --- a/internal/util/fswatcher.go +++ b/internal/util/fswatcher.go @@ -44,7 +44,9 @@ func AddListener(path string, l Listener) { } func FsWatcherShutdown() { - w.Close() + if w != nil { + w.Close() + } } func watchLoop(w *fsnotify.Watcher) {