add: macOS open browser
This commit is contained in:
parent
0beb50fadc
commit
f87a25d75e
Binary file not shown.
|
|
@ -10,6 +10,11 @@ func isWindows() bool {
|
||||||
return os == "windows"
|
return os == "windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isMacOS() bool {
|
||||||
|
os := runtime.GOOS
|
||||||
|
return os == "darwin"
|
||||||
|
}
|
||||||
|
|
||||||
func OpenBrowser(url string) {
|
func OpenBrowser(url string) {
|
||||||
if isWindows() {
|
if isWindows() {
|
||||||
cmd := exec.Command("cmd", "/C", "start", url)
|
cmd := exec.Command("cmd", "/C", "start", url)
|
||||||
|
|
@ -17,5 +22,11 @@ func OpenBrowser(url string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LogSystemError("Failed to open browser, error is " + err.Error())
|
LogSystemError("Failed to open browser, error is " + err.Error())
|
||||||
}
|
}
|
||||||
|
} else if isMacOS() {
|
||||||
|
cmd := exec.Command("open", url)
|
||||||
|
err := cmd.Start()
|
||||||
|
if err != nil {
|
||||||
|
LogSystemError("Failed to open browser, error is " + err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue