1package u
2
3import (
4 "errors"
5 "log/slog"
6 "os"
7)
8
9func FileExist(filename string) bool {
10 if _, err := os.Stat(filename); err == nil {
11 return true
12
13 } else if errors.Is(err, os.ErrNotExist) {
14 return false
15 } else {
16 slog.Warn("Schrödinger's file: it may or may not exist", "file", filename)
17 // Schrodinger: file may or may not exist. To be extra safe it will
18 // report the file doest not exist
19 return false
20 }
21}