From 487c22846a9fc0cfa7815bd7f39bd3a20f6b79df Mon Sep 17 00:00:00 2001 From: Mmx <1624045573@qq.com> Date: Wed, 24 Mar 2021 21:54:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=9C=A8crontab?= =?UTF-8?q?=E7=AD=89=E4=B8=AD=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Util/config.go | 6 ++++++ go.mod | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Util/config.go b/Util/config.go index df1105e..8d69ce5 100644 --- a/Util/config.go +++ b/Util/config.go @@ -5,6 +5,7 @@ import ( "Mmx/Modles" "fmt" "os" + "path/filepath" ) type config struct { @@ -30,6 +31,11 @@ func (*config) Generate(Form *Modles.LoginForm, Meta *Modles.LoginMeta) *Modles. } func (a *config) Init() *Modles.LoginInfo { + if t, err := os.Executable(); err != nil { + ErrHandler(err) + } else { + a.Path = filepath.Dir(t) + "/" + a.Path + } if !File.Exists(a.Path) { if err := File.Write(a.Path, &Modles.Config{ //默认值 From: Modles.LoginForm{ diff --git a/go.mod b/go.mod index df7e1a8..e6d8ad8 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module Mmx -go 1.15 +go 1.16