feat: migrate config beside executable
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user