fix(all): stabilize login and proxy-aware game startup

This commit is contained in:
2026-10-04 01:21:58 +08:00
parent 850c95d511
commit e4ce37bd8e
11 changed files with 295 additions and 12 deletions
+11 -1
View File
@@ -25,6 +25,16 @@ func launchGame(target string) error {
if err := exec.Command("pgrep", "-x", "BrownDust II").Run(); err == nil {
return errGameAlreadyRunning
}
args := append([]string{target, "--args"}, gameLaunchArguments()...)
// LaunchServices does not inherit open's environment; --env explicitly
// supplies the Unity variables to the newly launched application.
args := []string{target}
for _, entry := range gameProxyEnvironment(os.Environ(), systemGameProxy()) {
key, _, found := strings.Cut(entry, "=")
if found && (strings.EqualFold(key, "UNITY_PROXYSERVER") || strings.EqualFold(key, "UNITY_NOPROXY")) {
args = append(args, "--env", entry)
}
}
args = append(args, "--args")
args = append(args, gameLaunchArguments()...)
return exec.Command("open", args...).Start()
}