From 78a0943966934dd1cd24505f1a4dd7c790af074b Mon Sep 17 00:00:00 2001 From: cdle Date: Wed, 7 Jun 2023 21:16:30 +0800 Subject: [PATCH] x --- core/init.go | 13 ++++++++++--- main.go | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/init.go b/core/init.go index 063b978..d84ca41 100644 --- a/core/init.go +++ b/core/init.go @@ -46,8 +46,8 @@ func Init() { } } console.Debug("正在从 cdle/binary 获取最新版本 %s 编译文件...", latest_version) - qurl := "https://raw.githubusercontent.com/cdle/binary/master/sillyGirl_linux_" + runtime.GOARCH + "_" + latest_version - if runtime.GOARCH == "windows" { + qurl := "https://raw.githubusercontent.com/cdle/binary/master/sillyGirl_" + runtime.GOOS + "_" + runtime.GOARCH + "_" + latest_version + if runtime.GOOS == "windows" { qurl += ".exe" } resp, err := http.Get(qurl) @@ -73,6 +73,7 @@ func Init() { Error: fmt.Errorf("创建编译文件错误:%v", err), } } + defer f.Close() i, _ := io.Copy(f, resp.Body) if i < 2646140 { console.Error("创建编译文件错误:%v", i) @@ -81,7 +82,13 @@ func Init() { } } if runtime.GOOS == "windows" { - utils.Daemon("ready") + console.Log("正在准备重启...") + go func() { + time.Sleep(time.Second) + utils.Daemon("ready") + }() + + return nil } else { console.Debug("正在删除旧程序错误...") if err = os.RemoveAll(filename); err != nil { diff --git a/main.go b/main.go index 63d0a5d..e2c88c1 100644 --- a/main.go +++ b/main.go @@ -41,7 +41,6 @@ func main() { continue } } - if !d { t := false for _, arg := range os.Args {