goveal/fs/layered.go
2021-12-22 20:27:43 +01:00

26 lines
331 B
Go

package fs
import (
"io/fs"
"os"
)
type (
FS = fs.FS
File = fs.File
)
var Dir = os.DirFS
type Layered struct {
Layers []FS
}
func (l Layered) Open(name string) (file fs.File, err error) {
for idx := range l.Layers {
if file, err = l.Layers[idx].Open(name); err == nil {
return file, nil
}
}
return nil, err
}