feat(datamigrate): version the data folder and migrate it on startup
The data folder had no record of which layout wrote it, so a new release could not tell old data from current data. <DataRoot>\.reims-go-data.json now records data_version and the app version that last raised it. It is kept out of reims-go.json, which is rewritten whole on every save and would drop the field under an older build. Each build carries every step from older layouts to its own; the GUI and CLI run them in order before reading the folder, so users can jump straight from any old version. A failed step leaves the version at the last success and resumes next launch; a folder from a newer build is left untouched. Step v1 writes the driver ownership marker into every reims-ctl VM. driver.RenamedDriverIDs maps old driver IDs to new ones for when a driver moves to another plugin; markers are not rewritten, so downgrades still resolve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9baa1e341c
commit
809ce68cf3
9 files changed
+427
-5
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/datamigrate"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
@@ -69,6 +70,10 @@ func run(args []string) (i18n.Locale, error) {
|
||||
if *dataRootFlag != "" {
|
||||
cfg.DataRoot = *dataRootFlag
|
||||
}
|
||||
// Same data-folder upgrade the GUI runs on startup.
|
||||
if _, err := datamigrate.Run(cfg.DataRoot, version.Version); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "warning:", err)
|
||||
}
|
||||
// Load enabled static language packs from <DataRoot>/plugins before resolving
|
||||
// effective locale so "auto" and custom --lang tags (e.g. ja-JP, zh-TW) work in CLI.
|
||||
plugin.LoadStaticLocalePacks(cfg.DataRoot)
|
||||
|
||||
Reference in new issue
Block a user