Skip to content

Commit

Permalink
Auto-delete cache in the installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom5521 committed Jan 1, 2024
1 parent e34e35f commit 658898d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions internal/installer/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package installer

import (
"fmt"
"os"
"runtime"
"strconv"

Expand Down Expand Up @@ -240,6 +242,12 @@ func (ui *ui) FinalMsgCont() {
content.HideCancel = true
content.OnNext = func() {
ui.App.Quit()
if runtime.GOOS == "linux" {
err := os.RemoveAll("/tmp/EduTrack")
if err != nil {
fmt.Println(err)
}
}
}
content.TopItemsLayout = layout.NewVBoxLayout()
ui.Window.SetContent(content)
Expand Down
16 changes: 8 additions & 8 deletions pkg/wins/wins.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ func ErrWin(app fyne.App, err string, clWindow ...fyne.Window) {
if conf.Config.Lang == "en" || conf.Config.Lang == "" {
buttonText = "Accept"
}
window := app.NewWindow("Error")
window.RequestFocus()
window.Resize(sizes.ErrSize)
window.SetIcon(assets.Error)
w := app.NewWindow("Error")
w.RequestFocus()
w.Resize(sizes.ErrSize)
w.SetIcon(assets.Error)
errlabel := widget.NewLabel(err)
errlabel.TextStyle.Bold = true
errlabel.Alignment = fyne.TextAlignCenter
acceptButton := widget.NewButton(buttonText, func() {
window.Close()
w.Close()
if len(clWindow) > 0 {
clWindow[0].Close()
}
Expand All @@ -78,9 +78,9 @@ func ErrWin(app fyne.App, err string, clWindow ...fyne.Window) {
errlabel,
acceptButton,
)
window.SetContent(content)
window.SetMainMenu(window.MainMenu())
window.Show()
w.SetContent(content)
w.SetMainMenu(w.MainMenu())
w.Show()
}

// MaximizeWin resizes a given window to match the screen's resolution.
Expand Down

0 comments on commit 658898d

Please sign in to comment.