filelist/hookfiles: don't error out if dir is not found

Just print a message that it wasn't found, instead of sending an error
that may stop the entire app.
This commit is contained in:
Clayton Craft
2023-02-18 12:23:37 -08:00
parent e772fe0c87
commit 07c8c711c7

View File

@@ -26,12 +26,14 @@ func New(filePath string) *HookFiles {
}
func (h *HookFiles) List() (*filelist.FileList, error) {
log.Println("- Including files")
log.Printf("- Including file lists from %s", h.filePath)
files := filelist.NewFileList()
fileInfo, err := os.ReadDir(h.filePath)
if err != nil {
return nil, fmt.Errorf("getHookFiles: unable to read hook file dir: %w", err)
log.Println("-- Unable to find dir, skipping...")
return files, nil
}
files := filelist.NewFileList()
for _, file := range fileInfo {
path := filepath.Join(h.filePath, file.Name())
f, err := os.Open(path)