From dfcad8082bc1d81468ca0c332b22fe7744d90148 Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Thu, 24 Feb 2022 01:11:27 +0800 Subject: [PATCH] feat: check reset working dir exists --- internal/base/flag.go | 4 ++++ 1 file changed, 4 insertions(+) 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