quintodrome/resources/embed.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
455 B
Go
Raw Normal View History

package resources
import (
"embed"
"io"
"io/fs"
"os"
"path"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/utils"
)
var (
//go:embed *
fsys embed.FS
FS fs.FS
)
func Asset(path string) ([]byte, error) {
2021-07-20 14:43:15 -08:00
f, err := FS.Open(path)
if err != nil {
return nil, err
}
return io.ReadAll(f)
}
func init() {
FS = utils.MergeFS{
Base: fsys,
Overlay: os.DirFS(path.Join(conf.Server.DataFolder, "resources")),
}
}