修复 维护模式拦截异常的问题

This commit is contained in:
2026-05-12 03:37:42 +08:00
parent 7436cb704a
commit ca9a9cedfd
3 changed files with 190 additions and 33 deletions

View File

@@ -131,7 +131,16 @@ func GetDefaultAppConfig() *AppConfig {
// Init 初始化配置文件
func Init(cfgFilePath string) {
if !filepath.IsAbs(cfgFilePath) {
cfgFilePath = filepath.Join(utils.GetRootDir(), cfgFilePath)
if wd, err := os.Getwd(); err == nil {
candidate := filepath.Clean(filepath.Join(wd, cfgFilePath))
if _, statErr := os.Stat(candidate); statErr == nil {
cfgFilePath = candidate
} else {
cfgFilePath = filepath.Join(utils.GetRootDir(), cfgFilePath)
}
} else {
cfgFilePath = filepath.Join(utils.GetRootDir(), cfgFilePath)
}
}
currentConfigFilePath = cfgFilePath