From 9293458ef12bc4a0f71f9b19778b7eb9c5829fd4 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Tue, 7 Sep 2021 18:15:55 +0200 Subject: [PATCH] fstrigger build --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 1dddfd3..93ffda1 100644 --- a/main.go +++ b/main.go @@ -177,11 +177,14 @@ func startWatcher(directory *DirectoryConfig) { directory._regexMatches = directory._regex.FindStringSubmatch(p) } if directory._regex == nil || directory._regexMatches != nil { - var statErr error + var missing bool if directory.IgnoreMissing { - _, statErr = os.Stat(p) + if _, statErr := os.Stat(p); os.IsNotExist(statErr) { + missing = true + log.Printf("[ INFO ] path=\"%s\" missing=\"true\"\n", p) + } } - if directory.IgnoreMissing || !os.IsNotExist(statErr) { + if directory.IgnoreMissing || !missing { for _, action := range directory.Actions { action.Directory = directory contin, _ := runAction(&action, eventInfo, nil)