From 8301c9fe79621e9d4912d70398569f13470aea22 Mon Sep 17 00:00:00 2001 From: cdle Date: Wed, 7 Jun 2023 19:28:59 +0800 Subject: [PATCH] x --- main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 8e382bd..42ce9dc 100644 --- a/main.go +++ b/main.go @@ -27,14 +27,20 @@ func main() { if arg == "-d" { d = true } - if arg == "-r" && strings.Contains(os.Args[0], ".ready.exe") { //准备程序->原程序 - err := utils.CopyFile(utils.ProcessName, strings.Replace(utils.ProcessName, "ready.exe", ".exe", -1)) - if err == nil { - utils.Daemon("reset") + if arg == "-r" { //准备程序->原程序 + rfix := ".ready.exe" + if strings.Contains(os.Args[0], rfix) { + err := utils.CopyFile(utils.ProcessName, strings.Replace(utils.ProcessName, rfix, ".exe", -1)) + if err == nil { + utils.Daemon("reset") + } + } else { + os.Remove(strings.ReplaceAll(os.Args[0], ".exe", rfix)) } continue } } + if !d { t := false for _, arg := range os.Args {