feat: migrate config beside executable

This commit is contained in:
QiuSW
2026-07-27 11:33:22 +08:00
parent 206794f78c
commit eeb7950806
9 changed files with 307 additions and 42 deletions
+6
View File
@@ -476,6 +476,12 @@ func (s *Shell) SetSettings(value SettingsState) {
s.closeOnExit.Value = value.CloseOnExit
}
// ReportStartupIssue records a safe, user-recoverable configuration message.
// The application calls it before the frame loop starts; it performs no I/O.
func (s *Shell) ReportStartupIssue(message string) {
s.instanceFeedback = strings.TrimSpace(message)
}
func (s *Shell) OnSave(fn func(SettingsState)) { s.onSave = fn }
func (s *Shell) OnInstancesChanged(fn func([]InstanceRow)) { s.onInstancesChanged = fn }
+8
View File
@@ -26,6 +26,14 @@ func TestShellStartsWithSemanticInstanceStatuses(t *testing.T) {
}
}
func TestShellReportsSafeStartupIssue(t *testing.T) {
shell := NewShell(material.NewTheme())
shell.ReportStartupIssue(" 程序目录中的 config.json 无法使用;请检查目录权限或恢复旧配置。 ")
if shell.instanceFeedback != "程序目录中的 config.json 无法使用;请检查目录权限或恢复旧配置。" {
t.Fatalf("startup feedback = %q", shell.instanceFeedback)
}
}
func TestShellInstanceListScrollsVertically(t *testing.T) {
shell := NewShell(material.NewTheme())
if shell.list.Axis != layout.Vertical {