fix:修复在crontab等中配置文件路径异常的问题
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"Mmx/Modles"
|
"Mmx/Modles"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
@@ -30,6 +31,11 @@ func (*config) Generate(Form *Modles.LoginForm, Meta *Modles.LoginMeta) *Modles.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *config) Init() *Modles.LoginInfo {
|
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 !File.Exists(a.Path) {
|
||||||
if err := File.Write(a.Path, &Modles.Config{ //默认值
|
if err := File.Write(a.Path, &Modles.Config{ //默认值
|
||||||
From: Modles.LoginForm{
|
From: Modles.LoginForm{
|
||||||
|
|||||||
Reference in New Issue
Block a user