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