-
-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathmain.go
More file actions
62 lines (53 loc) · 1.35 KB
/
Copy pathmain.go
File metadata and controls
62 lines (53 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
import (
"context"
"embed"
"log"
"installer/api"
"installer/types"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
)
//go:embed all:frontend/build
var assets embed.FS
// Set by ldflags during build
var version = "v0.0.0-dev"
func main() {
// Create an instance of the app structure
app := NewApp()
controller := api.NewController()
// Create application with options
err := wails.Run(&options.App{
Title: "BetterDiscord Installer",
Frameless: true,
Width: 550,
Height: 350,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: func(ctx context.Context) {
app.SetContext(ctx)
controller.SetContext(ctx)
// Best-effort update check, kept early so it still runs even if a
// later startup step fails. It uses native dialogs (not the GUI log)
// and swallows its own errors, so running before the logger is wired
// up below is intentional and harmless.
app.CheckForUpdate()
// Setup default logger to send data to GUI
log.SetOutput(controller)
log.SetFlags(0) // Don't add date/time
},
Bind: []any{
app,
controller,
},
EnumBind: []any{
types.Channels,
},
})
if err != nil {
println("Error:", err.Error())
}
}