프로세스 종료시 알림

This commit is contained in:
2023-11-24 00:19:17 +09:00
parent d18fe3e3a1
commit 1a404e5361
9 changed files with 171 additions and 54 deletions

View File

@ -0,0 +1,42 @@
//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()
}