// file utility area // // This part of the utility package is primarily for file or path checking. package utility import ( _ "errors" "os" _ "path" _ "path/filepath" _ "strings" ) // Check if this is a file func IsFile(filePath string) (bool, error) { f, err := os.Stat(filePath) if err == nil { return !f.IsDir(), nil } if os.IsNotExist(err) { return false, nil } return false, err } // Check if this even exists func IsExist(path string) (bool, error) { _, err := os.Stat(path) if err == nil || os.IsExist(err) { return true, nil } if os.IsNotExist(err) { return false, nil } return false, err } // todo: add string checking, we can't paste binary