summaryrefslogtreecommitdiff
path: root/cmd/podman/utils/utils.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-04-14 13:31:29 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-04-17 10:26:50 +0200
commit60624f948bf0067059f3d05e1bdc54589a9911e9 (patch)
tree995b11c25b4abaef99ced55cf1eaf4ed4df73bb0 /cmd/podman/utils/utils.go
parent0d2b5532c417c58bd24e71a56c5c55b43e423a59 (diff)
downloadpodman-60624f948bf0067059f3d05e1bdc54589a9911e9.tar.gz
podman-60624f948bf0067059f3d05e1bdc54589a9911e9.tar.bz2
podman-60624f948bf0067059f3d05e1bdc54589a9911e9.zip
podmanV2: implement build
Implement `podman build` for the local client. The remote client will require some rather large work in the backend and a new build endpoint for the libpod rest API. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/utils/utils.go')
-rw-r--r--cmd/podman/utils/utils.go22
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()
+}