exists checks if file exists.
(fs afero.Fs, path string)
| 93 | |
| 94 | // exists checks if file exists. |
| 95 | func exists(fs afero.Fs, path string) (bool, error) { |
| 96 | stat, err := fs.Stat(path) |
| 97 | if err == nil { |
| 98 | return !stat.IsDir(), nil |
| 99 | } |
| 100 | if os.IsNotExist(err) { |
| 101 | return false, nil |
| 102 | } |
| 103 | return false, err |
| 104 | } |