// Readdir reads the directory entries.
518098
func (f *File) Readdir() ([]*File, error) {
	if !f.IsDir() {
		return nil, errors.New("not a directory")
	}
	return f.img.readdir(f.subdirOffset)
}
1052008
func (fs OsFS) ReadDir(path string) ([]os.FileInfo, error) {
	return ioutil.ReadDir(path)
}
742155
func readFilesInDir(dir string, out map[string]string) error {
	_, err := os.Stat(dir)
	if os.IsNotExist(err) {
		return nil
	}
	return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
		if err != nil || info.IsDir() {
			return err
		}
		body, err := ioutil.ReadFile(path)
		if err == nil {
			out[path] = string(body)
		}
		return err
	})
}
694738
func (c *Client) ReadDir(dirname string) ([]os.FileInfo, error) {
	f, err := c.Open(dirname)
	if err != nil {
		return nil, err
	}

	return f.Readdir(0)
}
624653
func readDirs(src string) ([]string, error) {
	var files []string

	err := filepath.Walk(src, func(path string, f os.FileInfo, err error) error {
		relativePath := strings.TrimPrefix(path, src)
		if len(relativePath) > 0 {
			files = append(files, relativePath)
		}
		return nil
	})
	if err != nil {
		return nil, err
	}
	return files, nil
}
979890
func (fl *FolderList) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error) {
	fl.fs.vlog.CLogf(ctx, libkb.VLog1, "FL ReadDirAll")
	defer func() {
		err = fl.fs.processError(ctx, libkbfs.ReadMode, err)
	}()
	session, err := fl.fs.config.KBPKI().GetCurrentSession(ctx)
	isLoggedIn := err == nil

	var favs []favorites.Folder
	if isLoggedIn {
		favs, err = fl.fs.config.KBFSOps().GetFavorites(ctx)
		if err != nil {
			return nil, err
		}
	}

	res = make([]fuse.Dirent, 0, len(favs))
	for _, fav := range favs {
		if fav.Type != fl.tlfType {
			continue
		}
		pname, err := tlf.CanonicalToPreferredName(
			session.Name, tlf.CanonicalName(fav.Name))
		if err != nil {
			fl.fs.log.Errorf("CanonicalToPreferredName: %q %v", fav.Name, err)
			continue
		}
		res = append(res, fuse.Dirent{
			Type: fuse.DT_Dir,
			Name: string(pname),
		})
	}
	return res, nil
}
47220
func (b *Box) readDirNames(path string) ([]string, error) {

	f, err := b.Open(path)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	stat, err := f.Stat()
	if err != nil {
		return nil, err
	}

	if !stat.IsDir() {
		return nil, nil
	}

	infos, err := f.Readdir(0)
	if err != nil {
		return nil, err
	}

	var names []string

	for _, info := range infos {
		names = append(names, info.Name())
	}

	sort.Strings(names)
	return names, nil

}
647094
func (b *Builder) AddDir(dir string) error {
	_, err := b.importPackage(dir, true)
	return err
}
838624
func (l *lcowfs) readDirNames(dirname string) ([]string, error) {
	f, err := l.Open(dirname)
	if err != nil {
		return nil, err
	}
	files, err := f.Readdir(-1)
	f.Close()
	if err != nil {
		return nil, err
	}

	names := make([]string, len(files), len(files))
	for i := range files {
		names[i] = files[i].Name()
	}

	sort.Strings(names)
	return names, nil
}
778162
func (b *Browser) ReadDir(p string) (fis []os.FileInfo, err error) {
	if p == "" {
		p = "."
	}

	if b.tree == nil {
		if p == "." {
			// Branch with no commits.
			return nil, nil
		}
		return nil, errors.New("Empty repo")
	}

	cachePath := path.Join(b.root, p)

	if fis, ok := b.sharedCache.getChildrenFileInfos(
		b.commitHash, cachePath); ok {
		return fis, nil
	}

	defer translateGitError(&err)
	var dirTree *object.Tree
	if p == "." {
		dirTree = b.tree
	} else {
		dirTree, err = b.tree.Tree(p)
		if err != nil {
			return nil, err
		}
	}

	childrenPathsToCache := make([]string, 0, len(dirTree.Entries))
	for _, e := range dirTree.Entries {
		fi, err := b.Lstat(path.Join(p, e.Name))
		if err != nil {
			return nil, err
		}
		fis = append(fis, fi)
		childrenPathsToCache = append(childrenPathsToCache, path.Join(cachePath, e.Name))
	}
	b.sharedCache.setChildrenPaths(
		b.commitHash, cachePath, childrenPathsToCache)

	return fis, nil
}
1345689
func (r *Dir) Read(name string) ([]byte, error) {
	return ioutil.ReadFile(filepath.Join(r.Base, name))
}
817157
func ProjectDir() string {
	_, filePath, _, _ := runtime.Caller(1)
	return filepath.Dir(filepath.Dir(filePath))
}
471386
func (fs *fakeFs) ReadDir(dirname string) ([]os.FileInfo, error) {
	return fs.a.ReadDir(dirname)
}
656699
func (fs DefaultFsEval) Readdir(path string) ([]os.FileInfo, error) {
	fh, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer fh.Close()
	return fh.Readdir(-1)
}
539744
func (rfs *RootFS) ReadDir(p string) (fis []os.FileInfo, err error) {
	if p == "" {
		p = "."
	}

	if p != "." {
		return nil, os.ErrNotExist
	}

	now := rfs.config.Clock().Now()
	return []os.FileInfo{
		&wrappedReadFileInfo{"private", 0, now, true},
		&wrappedReadFileInfo{"public", 0, now, true},
		&wrappedReadFileInfo{"team", 0, now, true},
	}, nil
}
941306
func (RealOS) ReadDir(dirname string) ([]os.FileInfo, error) {
	return ioutil.ReadDir(dirname)
}
628726
func ReadDir(dirpath string) ([]string, error) {
	dir, err := os.Open(dirpath)
	if err != nil {
		return nil, err
	}
	defer dir.Close()
	names, err := dir.Readdirnames(-1)
	if err != nil {
		return nil, err
	}
	sort.Strings(names)
	return names, nil
}