summaryrefslogtreecommitdiff
path: root/internal/utils/files.go
blob: a70d11c0410594d02d7ec0482af67f9ffbc3be7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package utils

import (
	"os"
)

// FileExists returns whether the given file or directory exists.
func FileExists(path string) (bool, error) {
	_, err := os.Stat(path)
	if err == nil {
		return true, nil
	}

	if os.IsNotExist(err) {
		return false, nil
	}

	return true, err
}