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:
@@ -26,12 +26,14 @@ func New(filePath string) *HookFiles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *HookFiles) List() (*filelist.FileList, error) {
|
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)
|
fileInfo, err := os.ReadDir(h.filePath)
|
||||||
if err != nil {
|
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 {
|
for _, file := range fileInfo {
|
||||||
path := filepath.Join(h.filePath, file.Name())
|
path := filepath.Join(h.filePath, file.Name())
|
||||||
f, err := os.Open(path)
|
f, err := os.Open(path)
|
||||||
|
Reference in New Issue
Block a user