Fix: get execute file path dynamically

This commit is contained in:
HFO4
2020-03-11 10:32:35 +08:00
parent b6e1e04ce0
commit 4d70f9fa3e
12 changed files with 27 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ V` + conf.BackendVersion + ` Commit #` + conf.LastCommit + ` Pro=` + conf.IsPr
================================================
`)
data, err := ioutil.ReadFile(string([]byte{107, 101, 121, 46, 98, 105, 110}))
data, err := ioutil.ReadFile(util.RelativePath(string([]byte{107, 101, 121, 46, 98, 105, 110})))
if err != nil {
util.Log().Panic("%s", err)
}

View File

@@ -34,9 +34,9 @@ func (b *GinFS) Exists(prefix string, filepath string) bool {
func InitStatic() {
var err error
if util.Exists("statics") {
if util.Exists(util.RelativePath("statics")) {
util.Log().Info("检测到 statics 目录存在,将使用此目录下的静态资源文件")
StaticFS = static.LocalFile("statics", false)
StaticFS = static.LocalFile(util.RelativePath("statics"), false)
} else {
StaticFS = &GinFS{}
StaticFS.(*GinFS).FS, err = fs.New()