From c9f93cd3132d5ec90cc5634976aad1e3844d68c0 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Fri, 10 Sep 2021 19:38:19 +1000 Subject: [PATCH] [windows] Handle naked `go build` --- v2/internal/appng/app_default.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 v2/internal/appng/app_default.go diff --git a/v2/internal/appng/app_default.go b/v2/internal/appng/app_default.go new file mode 100644 index 00000000..d87d51c1 --- /dev/null +++ b/v2/internal/appng/app_default.go @@ -0,0 +1,29 @@ +//go:build !dev && !production && windows + +package appng + +import ( + "github.com/leaanthony/winc/w32" + "github.com/wailsapp/wails/v2/pkg/options" + "os/exec" +) + +// App defines a Wails application structure +type App struct{} + +func (a *App) Run() error { + return nil +} + +// CreateApp creates the app! +func CreateApp(_ *options.App) (*App, error) { + result := w32.MessageBox(0, + `Wails applications will not build without the correct build tags. +Please use "wails build" or press "OK" to open the documentation on how to use "go build"`, + "Error", + w32.MB_ICONERROR|w32.MB_OKCANCEL) + if result == 1 { + exec.Command("rundll32", "url.dll,FileProtocolHandler", "https://wails.io").Start() + } + return nil, nil +}