27 lines
742 B
Go
27 lines
742 B
Go
//go:build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
)
|
|
|
|
func registerProtocol() {
|
|
executable, err := os.Executable()
|
|
if err != nil {
|
|
return
|
|
}
|
|
executable, err = filepath.Abs(executable)
|
|
if err != nil {
|
|
return
|
|
}
|
|
command := `"` + executable + `" "%1"`
|
|
|
|
_ = exec.Command("reg", "add", `HKCU\Software\Classes\dcauth`, "/ve", "/d", "URL:DCAuth Protocol", "/f").Run()
|
|
_ = exec.Command("reg", "add", `HKCU\Software\Classes\dcauth`, "/v", "URL Protocol", "/d", "", "/f").Run()
|
|
_ = exec.Command("reg", "add", `HKCU\Software\Classes\dcauth\DefaultIcon`, "/ve", "/d", executable+",0", "/f").Run()
|
|
_ = exec.Command("reg", "add", `HKCU\Software\Classes\dcauth\shell\open\command`, "/ve", "/d", command, "/f").Run()
|
|
}
|