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:
parent
eaffb1f1ab
commit
df4d6a3cca
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
# We don't need binaries.
|
# We don't need binaries.
|
||||||
urtrator
|
urtrator
|
||||||
*tar*
|
*tar*
|
||||||
|
|
||||||
|
# macOS things
|
||||||
|
.DS_Store
|
||||||
|
@ -10,5 +10,5 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
const (
|
const (
|
||||||
URTRATOR_VERSION = "0.1-beta1"
|
URTRATOR_VERSION = "0.1-beta2"
|
||||||
)
|
)
|
||||||
|
2
doc/installation/macos/make-app.sh
Normal file → Executable file
2
doc/installation/macos/make-app.sh
Normal file → Executable file
@ -32,7 +32,7 @@ if [ $? -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building URTrator..."
|
echo "Building URTrator..."
|
||||||
go build -v github.com/pztrn/urtrator
|
go install -v github.com/pztrn/urtrator
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to build URTrator! Please, create a new bug report at https://github.com/pztrn/urtrator and attach FULL console output!"
|
echo "Failed to build URTrator! Please, create a new bug report at https://github.com/pztrn/urtrator and attach FULL console output!"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -88,8 +89,7 @@ func (l *Launcher) Launch(server_profile *datamodels.Server, user_profile *datam
|
|||||||
launch_params = append(launch_params, additional_parameters[i])
|
launch_params = append(launch_params, additional_parameters[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user_profile.Second_x_session == "1" {
|
if runtime.GOOS == "linux" && user_profile.Second_x_session == "1" {
|
||||||
fmt.Println(launch_params)
|
|
||||||
launch_params = append([]string{launch_bin}, launch_params...)
|
launch_params = append([]string{launch_bin}, launch_params...)
|
||||||
display := l.findFreeDisplay()
|
display := l.findFreeDisplay()
|
||||||
launch_bin, err = exec.LookPath("xinit")
|
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)
|
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() {
|
||||||
go func() {
|
go func() {
|
||||||
cmd := exec.Command(launch_bin, launch_params...)
|
cmd := exec.Command(launch_bin, launch_params...)
|
||||||
|
@ -53,7 +53,7 @@ type OptionsProfile struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (op *OptionsProfile) browseForBinary() {
|
func (op *OptionsProfile) browseForBinary() {
|
||||||
op.f = gtk.NewFileChooserDialog("URTrator - Select Urban Terro binary", op.window, gtk.FILE_CHOOSER_ACTION_OPEN, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)
|
op.f = gtk.NewFileChooserDialog("URTrator - Select Urban Terror binary", op.window, gtk.FILE_CHOOSER_ACTION_OPEN, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)
|
||||||
op.f.Response(op.browseForBinaryHelper)
|
op.f.Response(op.browseForBinaryHelper)
|
||||||
op.f.Run()
|
op.f.Run()
|
||||||
}
|
}
|
||||||
@ -62,6 +62,7 @@ func (op *OptionsProfile) browseForBinaryHelper() {
|
|||||||
filename := op.f.GetFilename()
|
filename := op.f.GetFilename()
|
||||||
op.binary_path.SetText(filename)
|
op.binary_path.SetText(filename)
|
||||||
op.f.Destroy()
|
op.f.Destroy()
|
||||||
|
fmt.Println(filename)
|
||||||
|
|
||||||
// Check for valid filename.
|
// Check for valid filename.
|
||||||
// ToDo: add more OSes.
|
// ToDo: add more OSes.
|
||||||
@ -80,8 +81,11 @@ func (op *OptionsProfile) browseForBinaryHelper() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if runtime.GOOS == "darwin" {
|
} else if runtime.GOOS == "darwin" {
|
||||||
// No separate arch thing here, macOS now 64bit only.
|
// Official application: Quake3-UrT.app. Split by it and get second
|
||||||
if len(filename) > 0 && strings.Split(filename, ".")[1] != "x86_64" && strings.Split(filename, ".")[0] != "Quake3-UrT" {
|
// part of string.
|
||||||
|
if strings.Contains(filename, "Quake3-UrT.app") {
|
||||||
|
filename = strings.Split(filename, "Quake3-UrT.app")[1]
|
||||||
|
if len(filename) > 0 && !strings.Contains(strings.Split(filename, ".")[1], "x86_64") && !strings.Contains(strings.Split(filename, ".")[0], "Quake3-UrT") {
|
||||||
fmt.Println("Invalid binary selected!")
|
fmt.Println("Invalid binary selected!")
|
||||||
mbox_string := "Invalid binary selected!\nAccording to your OS, it should be Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64."
|
mbox_string := "Invalid binary selected!\nAccording to your OS, it should be Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64."
|
||||||
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
|
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
|
||||||
@ -91,6 +95,14 @@ func (op *OptionsProfile) browseForBinaryHelper() {
|
|||||||
m.Run()
|
m.Run()
|
||||||
op.binary_path.SetText("")
|
op.binary_path.SetText("")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mbox_string := "Invalid binary selected!\nAccording to your OS, it should be Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64.\n\nNote, that currently URTrator supports only official binary."
|
||||||
|
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
|
||||||
|
m.Response(func() {
|
||||||
|
m.Destroy()
|
||||||
|
})
|
||||||
|
m.Run()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +189,7 @@ func (op *OptionsProfile) Initialize(update bool) {
|
|||||||
op.another_x_session.SetTooltipText(another_x_tooltip)
|
op.another_x_session.SetTooltipText(another_x_tooltip)
|
||||||
op.vbox.PackStart(op.another_x_session, false, true, 5)
|
op.vbox.PackStart(op.another_x_session, false, true, 5)
|
||||||
// macOS can't do that :).
|
// macOS can't do that :).
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS != "linux" {
|
||||||
op.another_x_session.SetSensitive(false)
|
op.another_x_session.SetSensitive(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user