quintodrome/resources/embed.go

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

30 lines
402 B
Go
Raw Normal View History

package resources
import (
"embed"
"io/fs"
"os"
"path"
2024-02-03 08:05:03 -09:00
"sync"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/utils"
)
var (
//go:embed *
2024-02-03 08:05:03 -09:00
embedFS embed.FS
fsOnce sync.Once
fsys fs.FS
)
func FS() fs.FS {
2024-02-03 08:05:03 -09:00
fsOnce.Do(func() {
fsys = utils.MergeFS{
Base: embedFS,
Overlay: os.DirFS(path.Join(conf.Server.DataFolder, "resources")),
}
})
return fsys
}