MCPcopy Create free account
hub / github.com/WendellCraft/ModpackDebuggerKit / onBeforeClose

Method onBeforeClose

app.go:139–167  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

137}
138
139func (a *App) onBeforeClose(ctx context.Context) bool {
140 a.mu.Lock()
141 modified := a.ProjectModified
142 a.mu.Unlock()
143
144 if !modified {
145 return false
146 }
147
148 wailsRuntime.EventsEmit(a.ctx, "close-confirm", nil)
149 result := <-a.closeConfirmChan
150
151 switch result {
152 case "save":
153 if saveErr := a.SaveProject(); saveErr != nil {
154 wailsRuntime.MessageDialog(ctx, wailsRuntime.MessageDialogOptions{
155 Type: wailsRuntime.ErrorDialog,
156 Title: "Error",
157 Message: "Failed to save project: " + saveErr.Error(),
158 })
159 return true
160 }
161 return false
162 case "nosave":
163 return false
164 default:
165 return true
166 }
167}
168
169func (a *App) SubmitCloseAction(action string) {
170 select {

Callers

nothing calls this directly

Calls 1

SaveProjectMethod · 0.95

Tested by

no test coverage detected