返回 DeepSeek-Reasonix
config_load_warnings.go
根目录 / desktop / config_load_warnings.go
1 package main
2
3 const configLoadWarningsEvent = "config:load-warnings"
4
5 func (a *App) nextConfigLoadWarningsRevision() uint64 {
6 if a == nil {
7 return 0
8 }
9 return a.runtimeEvents.configWarningsRevision.Add(1)
10 }
11
12 func (a *App) configLoadWarningsHandler() func([]string) bool {
13 if a == nil {
14 return nil
15 }
16 revision := a.nextConfigLoadWarningsRevision()
17 return func(warnings []string) bool {
18 return a.emitConfigLoadWarnings(revision, warnings)
19 }
20 }
21
22 // emitConfigLoadWarnings transfers ownership of resilient-loader diagnostics
23 // to the persistent desktop banner. Returning false keeps boot's diagnostic
24 // notice when no Wails event context is available.
25 func (a *App) emitConfigLoadWarnings(revision uint64, warnings []string) bool {
26 if a == nil || a.ctx == nil || len(warnings) == 0 {
27 return false
28 }
29 owned := append([]string(nil), warnings...)
30 a.runtimeEvents.Emit(a.ctx, configLoadWarningsEvent, owned, revision)
31 return true
32 }
33
33 lines GO