github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/pkg/fileutil/file_exists.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package fileutil
     5  
     6  import "os"
     7  
     8  // FileExists checks a file's existence
     9  func FileExists(name string) bool {
    10  	if _, err := os.Stat(name); err != nil {
    11  		if os.IsNotExist(err) {
    12  			return false
    13  		}
    14  	}
    15  	return true
    16  }