add ErrorFileNotFound util function

This commit is contained in:
2013-08-13 23:12:08 -04:00
parent bdd8032f29
commit f3b4294b23
3 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path"
"syscall"
)
func EnsureDirExists(dir string) error {
@ -42,3 +43,10 @@ func CopyToTmp(src string, tmpdir string) (string, error) {
return outfile.Name(), nil
}
func ErrorFileNotFound(err error) bool {
if e, ok := err.(*os.PathError); ok && e.Err == syscall.ENOENT {
return true
}
return false
}