mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
cmd/ebitenmobile: Bug fix: .exe was requried on Windows
On Windows, executable files must have .exe extension, or exec.LookPath since exec.LookPath checks %PATHEXT%. This fixes the issue that ebitenmobile didn't invoke the original gobind wrapper and then didn't include and compile some Java files. Fixes #1096
This commit is contained in:
parent
b4a9538e1d
commit
cebc203e6f
@ -20,6 +20,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const gomobileHash = "2b26a4705d2481ef30846d291bd450445e2b5bdd"
|
||||
@ -57,6 +58,15 @@ func runGo(args ...string) error {
|
||||
return runCommand("go", args, env)
|
||||
}
|
||||
|
||||
// exe adds the .exe extension to the given filename.
|
||||
// Without .exe, the executable won't be found by exec.LookPath on Windows (#1096).
|
||||
func exe(filename string) string {
|
||||
if runtime.GOOS == "windows" {
|
||||
return filename + ".exe"
|
||||
}
|
||||
return filename
|
||||
}
|
||||
|
||||
func prepareGomobileCommands() error {
|
||||
tmp, err := ioutil.TempDir("", "ebitenmobile-")
|
||||
if err != nil {
|
||||
@ -96,10 +106,10 @@ func prepareGomobileCommands() error {
|
||||
if err := runGo("get", "golang.org/x/mobile@"+gomobileHash); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := runGo("build", "-o", filepath.Join("bin", "gomobile"), "golang.org/x/mobile/cmd/gomobile"); err != nil {
|
||||
if err := runGo("build", "-o", exe(filepath.Join("bin", "gomobile")), "golang.org/x/mobile/cmd/gomobile"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := runGo("build", "-o", filepath.Join("bin", "gobind-original"), "golang.org/x/mobile/cmd/gobind"); err != nil {
|
||||
if err := runGo("build", "-o", exe(filepath.Join("bin", "gobind-original")), "golang.org/x/mobile/cmd/gobind"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -110,7 +120,7 @@ func prepareGomobileCommands() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := runGo("build", "-o", filepath.Join("bin", "gobind"), "-tags", "ebitenmobilegobind", filepath.Join("src", "gobind.go")); err != nil {
|
||||
if err := runGo("build", "-o", exe(filepath.Join("bin", "gobind")), "-tags", "ebitenmobilegobind", filepath.Join("src", "gobind.go")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user