in file.go [101:118]
func (f *File) Get(ctx context.Context, scope Scope) (current ResourceState, err error) {
provider := f.provider(scope)
path := filepath.Join(provider.Prefix, f.Path)
info, err := os.Stat(path)
if errors.Is(err, fs.ErrNotExist) {
return &FileState{expected: !f.Absent}, nil
} else if err != nil {
return nil, err
}
return &FileState{
info: info,
expected: !f.Absent,
scope: scope,
content: func() (io.ReadCloser, error) {
return os.Open(path)
},
}, nil
}