43 lines
719 B
Go
43 lines
719 B
Go
|
|
//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()
|
||
|
|
}
|