summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJason T. Greene <jason.greene@redhat.com>2022-06-16 21:34:57 -0500
committerJason T. Greene <jason.greene@redhat.com>2022-06-16 23:46:24 -0500
commitce3d0954a51c1b958211a4cb41d3179c4c06fe8c (patch)
tree119830289599d60bc6396e706b7b89f44722fe60 /cmd
parent05fc5959ec9cf681625f6fdb61de980d698bed59 (diff)
downloadpodman-ce3d0954a51c1b958211a4cb41d3179c4c06fe8c.tar.gz
podman-ce3d0954a51c1b958211a4cb41d3179c4c06fe8c.tar.bz2
podman-ce3d0954a51c1b958211a4cb41d3179c4c06fe8c.zip
Open Windows tutorial after MSI installation
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/winpath/main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/winpath/main.go b/cmd/winpath/main.go
index 6fbe72837..b7aa7330d 100644
--- a/cmd/winpath/main.go
+++ b/cmd/winpath/main.go
@@ -12,6 +12,7 @@ import (
"syscall"
"unsafe"
+ "golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
)
@@ -26,6 +27,7 @@ const (
Environment = "Environment"
Add operation = iota
Remove
+ Open
NotSpecified
)
@@ -37,6 +39,8 @@ func main() {
op = Add
case "remove":
op = Remove
+ case "open":
+ op = Open
}
}
@@ -46,6 +50,14 @@ func main() {
os.Exit(ERR_BAD_ARGS)
}
+ // Hidden operation as a workaround for the installer
+ if op == Open && len(os.Args) > 2 {
+ if err := winOpenFile(os.Args[2]); err != nil {
+ os.Exit(OPERATION_FAILED)
+ }
+ os.Exit(0)
+ }
+
if err := modify(op); err != nil {
os.Exit(OPERATION_FAILED)
}
@@ -182,3 +194,9 @@ func alert(caption string) int {
return int(ret)
}
+
+func winOpenFile(file string) error {
+ verb, _ := syscall.UTF16PtrFromString("open")
+ fileW, _ := syscall.UTF16PtrFromString(file)
+ return windows.ShellExecute(0, verb, fileW, nil, nil, windows.SW_NORMAL)
+}