PathExists returns whether the given file or directory exists or not
(path string)
| 25 | |
| 26 | // PathExists returns whether the given file or directory exists or not |
| 27 | func PathExists(path string) (bool, error) { |
| 28 | _, err := os.Stat(path) |
| 29 | if err == nil { |
| 30 | return true, nil |
| 31 | } |
| 32 | if errors.Is(err, fs.ErrNotExist) { |
| 33 | return false, nil |
| 34 | } |
| 35 | return false, err |
| 36 | } |
no outgoing calls