pull/1037/head
不帅你报警 4 years ago
parent 990baf67f1
commit d1038c6764

@ -0,0 +1,3 @@
package global
var conf map[string]interface{}

@ -2,6 +2,7 @@ package conf
import (
"github.com/cloudreve/Cloudreve/v3/pkg/util"
"github.com/cloudreve/Cloudreve/v3/global"
"github.com/go-ini/ini"
"gopkg.in/go-playground/validator.v9"
)
@ -148,6 +149,7 @@ func Init(path string) {
util.Log()
}
global.conf := sections
}
// mapSection 将配置文件的 Section 映射到结构体上

@ -5,7 +5,7 @@ import (
"path"
"path/filepath"
"strings"
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
"github.com/cloudreve/Cloudreve/v3/global"
)
// DotPathToStandardPath 将","分割的路径转换为标准路径
@ -63,8 +63,9 @@ func RelativePath(name string) string {
if filepath.IsAbs(name) {
return name
}
if conf.SystemConfig.DataPath != "" {
return filepath.Join(conf.SystemConfig.DataPath, name)
SystemConfig, ok := global.conf[ "SystemConfig" ]
if SystemConfig.DataPath != "" {
return filepath.Join(SystemConfig.DataPath, name)
} else {
return RelativeExecutablePath(name)
}

Loading…
Cancel
Save