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