Added embedres.

- Exposes embed.FS (native) as a ui.Resources.
This commit is contained in:
Sander Schobers 2021-07-18 22:47:34 +02:00
parent bcd32f8372
commit 5a4dcd52b0

View File

@ -0,0 +1,24 @@
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)
}