Updated credits.
This commit is contained in:
parent
4adfdbe006
commit
3198659d11
@ -36,7 +36,9 @@ func newCredits(app *appContext, ctx ui.Context) *credits {
|
||||
"zntg: an abstraction for rendering (UIs)",
|
||||
" - https://opslag.de/schobers/zntg", "",
|
||||
"allg5: an Allegro abstraction for Go",
|
||||
" - https://opslag.de/schobers/allg5",
|
||||
" - https://opslag.de/schobers/allg5", "",
|
||||
"ut: a utility library",
|
||||
" - https://opslag.de/schobers/ut", "",
|
||||
"",
|
||||
"**... and also using**",
|
||||
"Allegro: cross-platform development library",
|
||||
@ -58,6 +60,10 @@ func newCredits(app *appContext, ctx ui.Context) *credits {
|
||||
" - https://github.com/nfnt/resize", "",
|
||||
"testify: a testing library for Go",
|
||||
" - https://github.com/stretchr/testify", "",
|
||||
"beep: a sound library",
|
||||
" - https://github.com/faiface/beep", "",
|
||||
"oto: a low level sound library",
|
||||
" - https://https://github.com/hajimehoshi/oto", "",
|
||||
"",
|
||||
"# THANKS",
|
||||
"",
|
||||
@ -79,7 +85,9 @@ func (c *credits) Handle(ctx ui.Context, e ui.Event) bool {
|
||||
s := c.content[c.hovering]
|
||||
if strings.HasPrefix(s, " - https://") {
|
||||
url := s[3:]
|
||||
c.openBrowser(url)
|
||||
if err := c.openBrowser(url); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
case *ui.KeyDownEvent:
|
||||
@ -146,20 +154,16 @@ func (c *credits) fonts(ctx ui.Context) []ui.Font {
|
||||
return fonts
|
||||
}
|
||||
|
||||
func (c *credits) openBrowser(url string) {
|
||||
var err error
|
||||
func (c *credits) openBrowser(url string) error {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
err = exec.Command("xdg-open", url).Start()
|
||||
return exec.Command("xdg-open", url).Start()
|
||||
case "windows":
|
||||
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
|
||||
return exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
|
||||
case "darwin":
|
||||
err = exec.Command("open", url).Start()
|
||||
return exec.Command("open", url).Start()
|
||||
default:
|
||||
err = fmt.Errorf("unsupported platform")
|
||||
}
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return fmt.Errorf("unsupported platform")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user