Files
gf/os/gres/gres.go

41 lines
835 B
Go
Raw Normal View History

// Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gres
2019-08-13 13:45:01 +08:00
const (
gPACKAGE_TEMPLATE = `package %s
import "github.com/gogf/gf/os/gres"
2019-08-13 13:45:01 +08:00
func init() {
if err := gres.Add(%s); err != nil {
panic(err)
}
}
2019-08-13 13:45:01 +08:00
`
)
var (
2019-08-13 13:45:01 +08:00
defaultResource = New()
)
2019-08-13 13:45:01 +08:00
func Add(content []byte, prefix ...string) error {
return defaultResource.Add(content, prefix...)
}
2019-08-13 13:45:01 +08:00
func Load(path string, prefix ...string) error {
return defaultResource.Load(path, prefix...)
}
2019-08-13 13:45:01 +08:00
func Scan(path string, pattern string, recursive ...bool) []*File {
return defaultResource.Scan(path, pattern, recursive...)
}
2019-08-13 13:45:01 +08:00
func Dump() {
defaultResource.Dump()
}