diff --git a/internal/daemon/watcher.go b/internal/daemon/watcher.go index 56888f1..f93589a 100644 --- a/internal/daemon/watcher.go +++ b/internal/daemon/watcher.go @@ -25,6 +25,11 @@ func runNotesDirsWatcher(dirs ...string) error { dirIgnores := config.IgnoredDirectories() for _, dir := range dirs { + if _, err := os.Stat(dir); err != nil { + log.Printf("Error creating watcher on directory '%s': %v\n", dir, err) + continue + } + // TODO: add oolong ignore system to blacklist certain subdirs/files if err = filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { if !d.IsDir() { diff --git a/internal/documents/corpus.go b/internal/documents/corpus.go index 2f95447..5b9da8f 100644 --- a/internal/documents/corpus.go +++ b/internal/documents/corpus.go @@ -4,6 +4,7 @@ import ( "errors" "io/fs" "log" + "os" "path/filepath" "slices" "sync" @@ -41,6 +42,11 @@ func ReadNotesDirs() error { docs := []*Document{} for _, dir := range config.NotesDirPaths() { + if _, err := os.Stat(dir); err != nil { + log.Printf("Error reading directory '%s': %v\n", dir, err) + continue + } + // extract all note file paths from notes directory paths := []string{} // TODO: add oolong ignore system to blacklist certain subdirs/files