pkg/utils: Add function to conveniently check if a path exists
https://github.com/containers/toolbox/pull/318
This commit is contained in:
parent
7ab4ca868c
commit
bd5b8065ae
|
|
@ -22,6 +22,15 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PathExists wraps around os.Stat providing a nice interface for checking an existence of a path.
|
||||||
|
func PathExists(path string) bool {
|
||||||
|
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func ShowManual(manual string) error {
|
func ShowManual(manual string) error {
|
||||||
manBinary, err := exec.LookPath("man")
|
manBinary, err := exec.LookPath("man")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue