pkger/pkging/mem/stat.go

19 lines
270 B
Go
Raw Normal View History

2019-09-03 18:29:28 +03:00
package mem
2019-09-01 00:00:24 +03:00
import (
"fmt"
"os"
)
2019-09-03 18:29:28 +03:00
func (fx *Pkger) Stat(name string) (os.FileInfo, error) {
2019-09-01 00:00:24 +03:00
pt, err := fx.Parse(name)
if err != nil {
return nil, err
}
f, ok := fx.files.Load(pt)
if ok {
return f.Stat()
}
2019-09-01 20:21:34 +03:00
return nil, fmt.Errorf("could not stat %s", pt)
2019-09-01 00:00:24 +03:00
}