exists returns whether the given file or directory exists or not.
(path string)
| 90 | |
| 91 | // exists returns whether the given file or directory exists or not. |
| 92 | func exists(path string) (bool, error) { |
| 93 | _, err := os.Stat(path) |
| 94 | if err == nil { |
| 95 | return true, nil |
| 96 | } |
| 97 | if os.IsNotExist(err) { |
| 98 | return false, nil |
| 99 | } |
| 100 | return false, err |
| 101 | } |