zntg/addons/aferores/afero.go
Sander Schobers 67e73a8671 Resources only exposes OpenResource (and Destroy).
PhysicalResources derives from Resources and exposes FetchResource.
Made dependency specific resource addons.
Extended the available resource options (fallback, path, refactored copy).
NewRenderer provides DefaultResources to the created renderer.
2020-05-25 22:24:06 +02:00

24 lines
453 B
Go

package aferores
import (
"io"
"github.com/spf13/afero"
"opslag.de/schobers/zntg/ui"
)
type aferoResources struct {
afero.Fs
}
var _ ui.Resources = &aferoResources{}
// New provides resources from a afero file system.
func New(fs afero.Fs) ui.Resources {
return &aferoResources{fs}
}
func (r *aferoResources) Destroy() error { return nil }
func (r *aferoResources) OpenResource(name string) (io.ReadCloser, error) { return r.Fs.Open(name) }