mirror of
https://github.com/fumiama/ReiBot.git
synced 2026-06-18 09:40:33 +08:00
add more
This commit is contained in:
20
lazy.go
Normal file
20
lazy.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package rei
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
)
|
||||
|
||||
// 下载并获取本 engine 文件夹下的懒加载数据
|
||||
func (e *Engine) GetLazyData(filename string, isDataMustEqual bool) ([]byte, error) {
|
||||
if e.datafolder == "" {
|
||||
return nil, errors.New("datafolder is empty")
|
||||
}
|
||||
if !strings.HasSuffix(e.datafolder, "/") || !strings.HasPrefix(e.datafolder, "data/") || !unicode.IsUpper(rune(e.datafolder[5])) {
|
||||
return nil, errors.New("invalid datafolder")
|
||||
}
|
||||
return file.GetLazyData(e.datafolder+filename, isDataMustEqual)
|
||||
}
|
||||
Reference in New Issue
Block a user