zntg/addons/embedres/embedres.go
Sander Schobers 5a4dcd52b0 Added embedres.
- Exposes embed.FS (native) as a ui.Resources.
2021-07-18 22:47:34 +02:00

25 lines
361 B
Go

package embedres
import (
"embed"
"io"
"opslag.de/schobers/zntg/ui"
)
var _ ui.Resources = &resources{}
type resources struct {
fs embed.FS
}
func New(fs embed.FS) ui.Resources {
return &resources{fs}
}
func (r resources) Destroy() error { return nil }
func (r resources) OpenResource(name string) (io.ReadCloser, error) {
return r.fs.Open(name)
}