35 lines
1.1 KiB
Go
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.emitLog(name, line) })
|
|
}
|