macOS fixes for profiles and launching. Version bump.

More fixes here. First, fixed binary path parsing for profiles,
so you should be able to add a profile on macOS now. Only one
requirement - you should add Quake3-UrT.x86_64 file, which located
inside Urban Terror's application bundle, under Contents/MacOS
directory.

Fixed the way we call Urban Terror on macOS and tested it. Should
work now flawlessly.

Bumped to 0.1.0-beta2, and mac-only release for now.
This commit is contained in:
2016-10-09 17:06:47 +05:00
parent eaffb1f1ab
commit df4d6a3cca
5 changed files with 35 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ import (
"fmt"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
@@ -88,8 +89,7 @@ func (l *Launcher) Launch(server_profile *datamodels.Server, user_profile *datam
launch_params = append(launch_params, additional_parameters[i])
}
}
if user_profile.Second_x_session == "1" {
fmt.Println(launch_params)
if runtime.GOOS == "linux" && user_profile.Second_x_session == "1" {
launch_params = append([]string{launch_bin}, launch_params...)
display := l.findFreeDisplay()
launch_bin, err = exec.LookPath("xinit")
@@ -98,7 +98,15 @@ func (l *Launcher) Launch(server_profile *datamodels.Server, user_profile *datam
}
launch_params = append(launch_params, "--", ":" + display)
}
fmt.Println(launch_params)
if runtime.GOOS == "darwin" {
// On macOS we should not start binary, but application bundle.
// So we will obtain app bundle path.
bundle_path := strings.Split(launch_bin, "/Contents")[0]
// and create special launch string, which involves open.
launch_bin = "/usr/bin/open"
launch_params = append([]string{launch_bin, "-W", bundle_path, "--args"}, launch_params...)
}
fmt.Println(launch_bin, launch_params)
go func() {
go func() {
cmd := exec.Command(launch_bin, launch_params...)