프로세스 종료시 알림
This commit is contained in:
42
client/platform_windows.go
Normal file
42
client/platform_windows.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user