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.
32 lines
804 B
Go
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()
|
|
}
|