diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-17 14:30:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 14:30:49 -0400 |
commit | a5884c07dfb092eab88cf153238e714910388a06 (patch) | |
tree | 2ff9de3f27c2cc9f9cc4b630494b93aeab78fc46 /cmd/podman/utils | |
parent | d68b028c9440cd3f952327b05f1bc8dee00ab98a (diff) | |
parent | 60624f948bf0067059f3d05e1bdc54589a9911e9 (diff) | |
download | podman-a5884c07dfb092eab88cf153238e714910388a06.tar.gz podman-a5884c07dfb092eab88cf153238e714910388a06.tar.bz2 podman-a5884c07dfb092eab88cf153238e714910388a06.zip |
Merge pull request #5819 from vrothberg/v2-build
podmanV2: implement build
Diffstat (limited to 'cmd/podman/utils')
-rw-r--r-- | cmd/podman/utils/utils.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go new file mode 100644 index 000000000..c7d105ba4 --- /dev/null +++ b/cmd/podman/utils/utils.go @@ -0,0 +1,22 @@ +package utils + +import "os" + +// IsDir returns true if the specified path refers to a directory. +func IsDir(path string) bool { + file, err := os.Stat(path) + if err != nil { + return false + } + return file.IsDir() +} + +// FileExists returns true if path refers to an existing file. +func FileExists(path string) bool { + file, err := os.Stat(path) + // All errors return file == nil + if err != nil { + return false + } + return !file.IsDir() +} |