|
@@ -30,7 +30,6 @@ var NatsPort int
|
|
|
type Config struct {
|
|
|
Version string
|
|
|
ExePath string
|
|
|
- Logo string
|
|
|
}
|
|
|
|
|
|
func RegApi(event *cef.BrowserEvent, window cef.IBrowserWindow, bw *cef.LCLBrowserWindow) {
|
|
@@ -44,15 +43,16 @@ func RegApi(event *cef.BrowserEvent, window cef.IBrowserWindow, bw *cef.LCLBrows
|
|
|
RegShortcut(event, window, bw)
|
|
|
|
|
|
// 更新配置文件
|
|
|
- ipc.On("UpdateConfig", func(config *Config) bool {
|
|
|
+ ipc.On("UpdateConfig", func(version string, exePath string) bool {
|
|
|
fmt.Println("==================更新配置文件信息=========================")
|
|
|
- fmt.Println(config)
|
|
|
- data, err := json.MarshalIndent(config, "", " ")
|
|
|
+ fmt.Println(version)
|
|
|
+ fmt.Println(exePath)
|
|
|
+ data, err := json.MarshalIndent(&Config{Version: version, ExePath: exePath}, "", " ")
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
return false
|
|
|
}
|
|
|
- err = os.WriteFile("./data/app.json", data, 0777)
|
|
|
+ err = os.WriteFile("data/app.json", data, 0777)
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
return false
|
|
@@ -62,7 +62,7 @@ func RegApi(event *cef.BrowserEvent, window cef.IBrowserWindow, bw *cef.LCLBrows
|
|
|
})
|
|
|
|
|
|
ipc.On("RunApp", func() bool {
|
|
|
- conf, err := os.Open("./data/app.json")
|
|
|
+ conf, err := os.Open("data/app.json")
|
|
|
if err != nil {
|
|
|
fmt.Println("打开配置文件错误")
|
|
|
fmt.Println(err)
|