Files
bd2/go/internal/client/app/platform_darwin.go
T
Flechazo e4276eb493 feat(all): configure proxies, reuse native HTTP and stabilize recovery
Persist direct/manual proxy settings in Client Studio and apply them to resource,
Unity and native requests, with loopback bypass and no automatic system proxy.
Pool WinHTTP/curl connections, bound workers and deadlines, cancel safely,
and log queue and transport timings without exposing sensitive paths.
Return explicit relay failures, probe through native HTTP, retry interrupted
requests and recognize completed home, field and pack scenes during recovery.
2026-10-04 20:10:01 +08:00

32 lines
804 B
Go

//go:build darwin
package app
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
func ShowFatalError(err error) {
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "BD2 Client Studio:", err)
}
}
func launchGame(target, proxyURL string) error {
info, err := os.Stat(target)
if err != nil || !info.IsDir() || !strings.EqualFold(filepath.Ext(target), ".app") {
return fmt.Errorf("invalid macOS application bundle %q", target)
}
if err := exec.Command("pgrep", "-x", "BrownDust II").Run(); err == nil {
return errGameAlreadyRunning
}
// LaunchServices does not inherit open's environment; --env explicitly
// supplies the Unity variables to the newly launched application.
args := gameOpenArguments(target, os.Environ(), proxyURL)
return exec.Command("open", args...).Start()
}