diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-16 23:20:23 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-16 23:23:43 +0200 |
commit | 1d678dfdfa026968dbb19795c9bed16385603b21 (patch) | |
tree | cac862609d0103ee30da39cd0054b11884248e9d /vendor/github.com/skratchdot/open-golang/open/exec_windows.go | |
parent | 131a862d313f12808d63e832126317a27226940b (diff) | |
download | git-bug-1d678dfdfa026968dbb19795c9bed16385603b21.tar.gz |
vendor dependencies with dep
Diffstat (limited to 'vendor/github.com/skratchdot/open-golang/open/exec_windows.go')
-rw-r--r-- | vendor/github.com/skratchdot/open-golang/open/exec_windows.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/skratchdot/open-golang/open/exec_windows.go b/vendor/github.com/skratchdot/open-golang/open/exec_windows.go new file mode 100644 index 00000000..2d936177 --- /dev/null +++ b/vendor/github.com/skratchdot/open-golang/open/exec_windows.go @@ -0,0 +1,28 @@ +// +build windows + +package open + +import ( + "os" + "os/exec" + "path/filepath" + "strings" +) + +var ( + cmd = "url.dll,FileProtocolHandler" + runDll32 = filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe") +) + +func cleaninput(input string) string { + r := strings.NewReplacer("&", "^&") + return r.Replace(input) +} + +func open(input string) *exec.Cmd { + return exec.Command(runDll32, cmd, input) +} + +func openWith(input string, appName string) *exec.Cmd { + return exec.Command("cmd", "/C", "start", "", appName, cleaninput(input)) +} |