Lines Matching refs:fs

42 	fs := &mockFs{
51 fs.symlinks[strings.TrimSpace(tokens[0])] = strings.TrimSpace(tokens[1])
55 fs.files[filepath.Clean(f)] = b
58 fs.dirs[dir] = true
61 fs.dirs[dir] = true
64 fs.dirs["."] = true
65 fs.dirs["/"] = true
67 for f := range fs.files {
68 fs.all = append(fs.all, f)
71 for d := range fs.dirs {
72 fs.all = append(fs.all, d)
75 for s := range fs.symlinks {
76 fs.all = append(fs.all, s)
79 sort.Strings(fs.all)
81 return fs
134 func (fs *osFs) toAbs(path string) string {
138 return filepath.Join(fs.srcDir, path)
141 func (fs *osFs) removeSrcDirPrefix(path string) string {
142 if fs.srcDir == "" {
145 rel, err := filepath.Rel(fs.srcDir, path)
148 fs.srcDir, path, err))
152 fs.srcDir, path, rel))
157 func (fs *osFs) removeSrcDirPrefixes(paths []string) []string {
158 if fs.srcDir != "" {
160 paths[i] = fs.removeSrcDirPrefix(path)
166 func (fs *osFs) Open(name string) (ReaderAtSeekerCloser, error) {
167 return os.Open(fs.toAbs(name))
170 func (fs *osFs) Exists(name string) (bool, bool, error) {
171 stat, err := os.Stat(fs.toAbs(name))
181 func (fs *osFs) IsDir(name string) (bool, error) {
182 info, err := os.Stat(fs.toAbs(name))
189 func (fs *osFs) IsSymlink(name string) (bool, error) {
190 if info, err := os.Lstat(fs.toAbs(name)); err != nil {
197 func (fs *osFs) Glob(pattern string, excludes []string, follow ShouldFollowSymlinks) (matches, dirs…
198 return startGlob(fs, pattern, excludes, follow)
201 func (fs *osFs) glob(pattern string) ([]string, error) {
202 paths, err := filepath.Glob(fs.toAbs(pattern))
203 fs.removeSrcDirPrefixes(paths)
207 func (fs *osFs) Lstat(path string) (stats os.FileInfo, err error) {
208 return os.Lstat(fs.toAbs(path))
211 func (fs *osFs) Stat(path string) (stats os.FileInfo, err error) {
212 return os.Stat(fs.toAbs(path))
216 func (fs *osFs) ListDirsRecursive(name string, follow ShouldFollowSymlinks) (dirs []string, err err…
217 return listDirsRecursive(fs, name, follow)
220 func (fs *osFs) ReadDirNames(name string) ([]string, error) {
221 dir, err := os.Open(fs.toAbs(name))
236 func (fs *osFs) Readlink(name string) (string, error) {
237 return os.Readlink(fs.toAbs(name))
499 func listDirsRecursive(fs FileSystem, name string, follow ShouldFollowSymlinks) ([]string, error) {
502 isDir, err := fs.IsDir(name)
513 subDirs, err := listDirsRecursiveRelative(fs, name, follow, 0)
525 func listDirsRecursiveRelative(fs FileSystem, name string, follow ShouldFollowSymlinks, depth int) …
530 contents, err := fs.ReadDirNames(name)
541 if isSymlink, _ := fs.IsSymlink(f); isSymlink && follow == DontFollowSymlinks {
544 if isDir, _ := fs.IsDir(f); isDir {
546 subDirs, err := listDirsRecursiveRelative(fs, f, follow, depth)