Files
Reims-Go/internal/app/opencore_flow.go
T
Nwflower 59aaf36eb5 refactor(app): key VM runtime state by VMRef
Qualify transitions, pending changes, reboot watchers, disk/process caches, typing queues, thumbnail locks, and VM log sources so same-named VMs do not share mutable state.

Read driver-qualified transition keys in the frontend and add --start-driver to CLI/window handoff. Legacy window start rejects other drivers explicitly until lifecycle routing lands.
2026-11-30 07:51:10 -07:00

35 lines
1.1 KiB
Go

package app
import (
"github.com/Nwflower/reims-go/internal/macos/opencore"
"github.com/Nwflower/reims-go/internal/macos/reims"
"github.com/Nwflower/reims-go/internal/vmstart"
)
// populateGuestLangDetail fills VMDetail.GuestLang from the VM's persisted
// sidecar preference, falling back to reading prev-lang:kbd directly from its
// OpenCore image so existing VMs accurately reflect their boot/recovery locale.
func (a *App) populateGuestLangDetail(d *reims.VMDetail) {
if d == nil || d.Directory == "" {
return
}
if saved := opencore.ReadSavedGuestLang(d.Directory); saved != "" {
d.GuestLang = saved
return
}
if ocPath := opencore.ResolveOpenCorePath(d.Directory); ocPath != "" {
if lang, err := opencore.ReadImagePrevLang(ocPath); err == nil && lang != "" {
d.GuestLang = lang
}
}
}
// prep returns the shared start/OpenCore helpers (internal/vmstart) for one VM,
// logging to that VM's log panel.
func (a *App) prep(name string) (*vmstart.Prep, error) {
a.mu.Lock()
cfg := *a.cfg
a.mu.Unlock()
return vmstart.New(cfg, func(line string) { a.emitVMLog(name, line) })
}