mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08: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
ff9e0d699e
commit
0ae00aa138
@ -59,6 +59,15 @@ func runGo(args ...string) error {
|
||||
return runCommand(gocmd, 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 {
|
||||
@ -98,10 +107,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
|
||||
}
|
||||
|
||||
@ -112,7 +121,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