summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-06-22 11:21:59 +0000
committerGitHub <noreply@github.com>2022-06-22 11:21:59 +0000
commit00ce793f0db8bbbc5a5048c9b75512fb506eee93 (patch)
treec4bf51dd21b24f904adbfe99d10f7913e09c4960 /cmd
parent15a651f860191a6cfe0b3d5f1c0a846e6a584091 (diff)
parentce3d0954a51c1b958211a4cb41d3179c4c06fe8c (diff)
downloadpodman-00ce793f0db8bbbc5a5048c9b75512fb506eee93.tar.gz
podman-00ce793f0db8bbbc5a5048c9b75512fb506eee93.tar.bz2
podman-00ce793f0db8bbbc5a5048c9b75512fb506eee93.zip
Merge pull request #14631 from n1hility/opendoc-after-install
Open Windows tutorial after MSI installation
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)
+}