github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/pkg/fileutil/file_exists_windows.go (about) 1 package fileutil 2 3 import ( 4 "errors" 5 "golang.org/x/sys/windows" 6 "os" 7 "syscall" 8 ) 9 10 // FileExists checks a file's existence 11 func FileExists(name string) bool { 12 if _, err := os.Stat(name); err != nil { 13 if os.IsNotExist(err) { 14 return false 15 } 16 if errors.Is(err, syscall.Errno(windows.ERROR_INVALID_NAME)) { 17 return false 18 } 19 } 20 return true 21 }