Skip to content

Commit

Permalink
Merge pull request #2 from foomo/fix-cellar-filename
Browse files Browse the repository at this point in the history
fix: handle not exists
  • Loading branch information
franklinkim authored Oct 17, 2024
2 parents 7370d7c + 1574f8e commit 33c61f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/ownbrew/ownbrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,12 @@ func (o *Ownbrew) cellarFilename(name, version string) (string, error) {
)

info, err := os.Stat(ret)
if err != nil && !errors.Is(err, os.ErrNotExist) {
if errors.Is(err, os.ErrNotExist) {
return ret, nil
} else if err != nil {
return "", errors.Wrap(err, "failed to retrieve file info")
}

if info.IsDir() {
ret = path.Join(ret, name)
}
Expand Down

0 comments on commit 33c61f1

Please sign in to comment.