-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.go
62 lines (50 loc) · 1.04 KB
/
main.go
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 (
_ "embed"
"github.com/qaware/dev-tool-kit/backend/core"
"github.com/qaware/dev-tool-kit/backend/ui"
"github.com/wailsapp/wails"
"io/ioutil"
"os"
"path"
"runtime/debug"
"time"
)
var version = "3.4.2"
//go:embed frontend/build/main.js
var js string
//go:embed frontend/build/main.css
var css string
func main() {
app := wails.CreateApp(&wails.AppConfig{
Width: 1300,
Height: 800,
Title: "DevToolKit",
JS: js,
CSS: css,
Colour: "#D4DCE5",
Resizable: true,
})
bus := &ui.Bus{}
app.Bind(bus)
go core.InitUpgrade(version)
go core.CreateAsciiFont()
defer panicRecover()
app.Run()
}
func panicRecover() {
recovered := recover()
if recovered == nil {
return
}
exe, err := os.Executable()
if err != nil {
return
}
dir := path.Dir(exe)
appError, ok := recovered.(error)
if ok {
content := time.Now().String() + "\nVersion: " + version + "\n\n" + appError.Error() + "\n" + string(debug.Stack())
_ = ioutil.WriteFile(path.Join(dir, "panic.txt"), []byte(content), 0777)
}
}