Files
houston/client/platform_windows.go

43 lines
719 B
Go
Raw Normal View History

2023-11-24 00:19:17 +09:00
//go:build !(client && linux)
package client
import (
"errors"
"io/fs"
"os"
"os/exec"
"path"
)
func run_prelaunch_script(exepath string) error {
scriptPath := path.Join(path.Dir(exepath), "prelaunch.bat")
fi, err := os.Stat(scriptPath)
if errors.Is(err, fs.ErrNotExist) {
return nil
}
if fi == nil {
return nil
}
os.Chmod(scriptPath, 0777)
return exec.Command("cmd", scriptPath).Run()
}
func run_postlaunch_script(exepath string) error {
scriptPath := path.Join(path.Dir(exepath), "postlaunch.bat")
fi, err := os.Stat(scriptPath)
if errors.Is(err, fs.ErrNotExist) {
return nil
}
if fi == nil {
return nil
}
os.Chmod(scriptPath, 0777)
return exec.Command("cmd", scriptPath).Run()
}