Setup: Don't break if setup not completed, fix restart
Since an invalid example config was created on first run, if the app restarted before setup was completed, it would crash on the next start. The example now has a "first_run" flag in it, which is only set to false when the config is modified. Also fixed restart at the end of setup for tray builds.
This commit is contained in:
@@ -53,11 +53,29 @@ func onReady() {
|
||||
}()
|
||||
|
||||
RESTART = make(chan bool, 1)
|
||||
TRAYRESTART = make(chan bool, 1)
|
||||
go start(false, true)
|
||||
mStart.Disable()
|
||||
mStop.Enable()
|
||||
mRestart.Enable()
|
||||
go as.HandleCheck()
|
||||
trayRestart := func() {
|
||||
if RUNNING {
|
||||
RESTART <- true
|
||||
mStop.Disable()
|
||||
mStart.Enable()
|
||||
mRestart.Disable()
|
||||
for {
|
||||
if !RUNNING {
|
||||
break
|
||||
}
|
||||
}
|
||||
go start(false, false)
|
||||
mStart.Disable()
|
||||
mStop.Enable()
|
||||
mRestart.Enable()
|
||||
}
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-mStart.ClickedCh:
|
||||
@@ -74,22 +92,10 @@ func onReady() {
|
||||
mStart.Enable()
|
||||
mRestart.Disable()
|
||||
}
|
||||
case <-TRAYRESTART:
|
||||
trayRestart()
|
||||
case <-mRestart.ClickedCh:
|
||||
if RUNNING {
|
||||
RESTART <- true
|
||||
mStop.Disable()
|
||||
mStart.Enable()
|
||||
mRestart.Disable()
|
||||
for {
|
||||
if !RUNNING {
|
||||
break
|
||||
}
|
||||
}
|
||||
go start(false, false)
|
||||
mStart.Disable()
|
||||
mStop.Enable()
|
||||
mRestart.Enable()
|
||||
}
|
||||
trayRestart()
|
||||
case <-mOpenLogs.ClickedCh:
|
||||
open.Start(logPath)
|
||||
case <-mQuit.ClickedCh:
|
||||
|
||||
Reference in New Issue
Block a user