package tins2020 import ( rice "github.com/GeertJohan/go.rice" "github.com/spf13/afero" "opslag.de/schobers/fs/ricefs" "opslag.de/schobers/fs/vfs" ) type Resources struct { box *rice.Box fs afero.Fs copy vfs.CopyDir } func (r *Resources) Box() *rice.Box { return r.box } func (r *Resources) Destroy() { r.copy.Destroy() } func (r *Resources) Fs() afero.Fs { return r.fs } func (r *Resources) Open(box *rice.Box) error { r.box = box r.fs = vfs.NewOsFsFallback(r.box.Name(), ricefs.NewFs(box)) copy, err := vfs.NewCopyDir(r.fs) if err != nil { return err } r.copy = copy return nil } func (r *Resources) Copy() vfs.CopyDir { return r.copy } func (r *Resources) Retrieve(name string) (string, error) { return r.copy.Retrieve(name) }