Simplify GUI settings and build flags
This commit is contained in:
6
cmd/vrc_osc_launcher/launcher_icon.go
Normal file
6
cmd/vrc_osc_launcher/launcher_icon.go
Normal file
@@ -0,0 +1,6 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
// This file exists so the launcher package has a Windows build target
|
||||
// alongside the generated .syso resource file.
|
||||
@@ -6,15 +6,18 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"vrc_osc_go/internal/app"
|
||||
"vrc_osc_go/internal/buildinfo"
|
||||
"vrc_osc_go/internal/common"
|
||||
"vrc_osc_go/internal/update"
|
||||
)
|
||||
|
||||
func main() {
|
||||
_ = appendLauncherLog("LAUNCHER", "launcher main begin")
|
||||
var baseURL string
|
||||
var ownerRepo string
|
||||
var assetName string
|
||||
@@ -32,22 +35,34 @@ func main() {
|
||||
}
|
||||
if _, err := mgr.CheckAndUpdate(); err != nil {
|
||||
log.Printf("auto update skipped: %v", err)
|
||||
_ = appendLauncherLog("LAUNCHER", "auto update skipped: "+err.Error())
|
||||
} else {
|
||||
_ = appendLauncherLog("LAUNCHER", "auto update ok")
|
||||
}
|
||||
base := runtimeBaseDir()
|
||||
exe := filepath.Join(base, "vrc_osc.exe")
|
||||
gui := filepath.Join(base, "vrc_osc_gui.exe")
|
||||
_ = appendLauncherLog("LAUNCHER", "runtimeBaseDir="+base)
|
||||
if _, err := os.Stat(exe); err != nil {
|
||||
_ = appendLauncherLog("LAUNCHER", "missing runtime exe: "+err.Error())
|
||||
showError("vrc_osc_launcher", "missing exe: "+err.Error())
|
||||
log.Fatalf("missing exe: %v", err)
|
||||
}
|
||||
_ = appendLauncherLog("LAUNCHER", "version="+buildinfo.Version+" build="+buildinfo.BuildTime+" base="+base+" exe="+exe+" gui="+gui)
|
||||
if _, err := os.Stat(gui); err == nil {
|
||||
_ = appendLauncherLog("LAUNCHER", "starting gui companion")
|
||||
_ = exec.Command(gui).Start()
|
||||
} else {
|
||||
_ = appendLauncherLog("LAUNCHER", "gui companion missing: "+err.Error())
|
||||
}
|
||||
args := append([]string{"--no-gui"}, os.Args[1:]...)
|
||||
_ = appendLauncherLog("LAUNCHER", "launching runtime args="+strings.Join(args, " "))
|
||||
if err := update.Launch(exe, args); err != nil {
|
||||
_ = appendLauncherLog("LAUNCHER", "launch failed: "+err.Error())
|
||||
showError("vrc_osc_launcher", "launch failed: "+err.Error())
|
||||
log.Fatalf("launch failed: %v", err)
|
||||
}
|
||||
_ = appendLauncherLog("LAUNCHER", "runtime launch returned")
|
||||
}
|
||||
|
||||
func showError(title, message string) {
|
||||
@@ -73,3 +88,7 @@ func runtimeBaseDir() string {
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
func appendLauncherLog(title, text string) error {
|
||||
return app.AppendRuntimeLog(title, text)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user