ut/utio/dir.go

25 lines
483 B
Go
Raw Normal View History

package utio
import (
"os"
homedir "github.com/mitchellh/go-homedir"
)
// Home gives back the home directory for the current user.
func Home() (string, error) {
return homedir.Dir()
}
// PathExists tests if the supplied path exists.
func PathExists(path string) bool {
var _, err = os.Stat(path)
return err == nil
}
// PathDoesNotExist tests if the supplied does not exist.
func PathDoesNotExist(path string) bool {
var _, err = os.Stat(path)
return os.IsNotExist(err)
}