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