Files
oasis/scripts/oasis.go
Christian Bundy 9b53ee94dc Replace C launcher with Golang launcher
Problem: I don't know what I'm doing and can't figure out how to
cross-compile this simple C program to macOS and Windows

Solution: @cryptix reminded me that Go makes cross-compiling easy, so I
took a stab at writing my first Go program. It seems to be working on
macOS and Linux, but I haven't tested on Windows.
2020-02-26 18:20:47 -08:00

34 lines
473 B
Go

package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
var node string
func main() {
node := filepath.Join(filepath.Dir(os.Args[0]), node)
src := filepath.Join(filepath.Dir(os.Args[0]), "src")
args := []string{src}
for i := 1; i < len(os.Args); i++ {
args = append(args, os.Args[i])
}
cmd := exec.Command(node, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
fmt.Println(err)
}
fmt.Println(args)
}