Skip to content

Commit

Permalink
feat: return empty list if dir not exists when using readdir
Browse files Browse the repository at this point in the history
  • Loading branch information
femnad committed Jul 15, 2023
1 parent 9841cfa commit b37b535
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion selection/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ func readdir(target string, settings entity.ActionSettings) ([]entity.Entry, err
var out []entity.Entry
target = mare.ExpandUser(target)
entries, err := os.ReadDir(target)
if err != nil {
if os.IsNotExist(err) {
return out, nil
} else if err != nil {
return out, fmt.Errorf("error reading contents of directory %s: %v", target, err)
}

Expand Down

0 comments on commit b37b535

Please sign in to comment.