mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
Open Windows tutorial after MSI installation
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user