1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

feat: check reset working dir exists

This commit is contained in:
Mrs4s 2022-02-24 01:11:27 +08:00
parent 325bd42734
commit dfcad8082b
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

View File

@ -11,6 +11,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/Mrs4s/go-cqhttp/global"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
@ -140,6 +141,9 @@ func ResetWorkingDir() {
} }
} }
p, _ := filepath.Abs(os.Args[0]) p, _ := filepath.Abs(os.Args[0])
if !global.PathExists(p) {
log.Fatalf("重置工作目录时出现错误: 无法找到路径 %v", p)
}
proc := exec.Command(p, args...) proc := exec.Command(p, args...)
proc.Stdin = os.Stdin proc.Stdin = os.Stdin
proc.Stdout = os.Stdout proc.Stdout = os.Stdout