Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for DirEntry (0.72 sec)

  1. src/io/fs/readdir.go

    	ReadDir(name string) ([]DirEntry, error)
    }
    
    // ReadDir reads the named directory
    // and returns a list of directory entries sorted by filename.
    //
    // If fs implements [ReadDirFS], ReadDir calls fs.ReadDir.
    // Otherwise ReadDir calls fs.Open and uses ReadDir and Close
    // on the returned file.
    func ReadDir(fsys FS, name string) ([]DirEntry, error) {
    	if fsys, ok := fsys.(ReadDirFS); ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  2. src/os/dir.go

    		names = []string{}
    	}
    	return names, err
    }
    
    // A DirEntry is an entry read from a directory
    // (using the [ReadDir] function or a [File.ReadDir] method).
    type DirEntry = fs.DirEntry
    
    // ReadDir reads the contents of the directory associated with the file f
    // and returns a slice of [DirEntry] values in directory order.
    // Subsequent calls on the same file will yield later DirEntry records in the directory.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  3. src/testing/fstest/mapfs.go

    	return 0, &fs.PathError{Op: "read", Path: d.path, Err: fs.ErrInvalid}
    }
    
    func (d *mapDir) ReadDir(count int) ([]fs.DirEntry, error) {
    	n := len(d.entry) - d.offset
    	if n == 0 && count > 0 {
    		return nil, io.EOF
    	}
    	if count > 0 && n > count {
    		n = count
    	}
    	list := make([]fs.DirEntry, n)
    	for i := range list {
    		list[i] = &d.entry[d.offset+i]
    	}
    	d.offset += n
    	return list, nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  4. src/testing/fstest/testfs_test.go

    	f, err := MapFS(fsys).Open(name)
    	if err != nil {
    		return nil, err
    	}
    	return &shuffledFile{File: f}, nil
    }
    
    type shuffledFile struct{ fs.File }
    
    func (f *shuffledFile) ReadDir(n int) ([]fs.DirEntry, error) {
    	dirents, err := f.File.(fs.ReadDirFile).ReadDir(n)
    	// Shuffle in a deterministic way, all we care about is making sure that the
    	// list of directory entries is not is the lexicographic order.
    	//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  5. src/cmd/fix/main.go

    }
    
    func walkDir(path string) {
    	filepath.WalkDir(path, visitFile)
    }
    
    func visitFile(path string, f fs.DirEntry, err error) error {
    	if err == nil && isGoFile(f) {
    		err = processFile(path, false)
    	}
    	if err != nil {
    		report(err)
    	}
    	return nil
    }
    
    func isGoFile(f fs.DirEntry) bool {
    	// ignore non-Go files
    	name := f.Name()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 19:41:17 UTC 2024
    - 5.4K bytes
    - Viewed (0)
  6. src/io/ioutil/ioutil.go

    // ReadDir returns no directory entries along with the error.
    //
    // Deprecated: As of Go 1.16, [os.ReadDir] is a more efficient and correct choice:
    // it returns a list of [fs.DirEntry] instead of [fs.FileInfo],
    // and it returns partial results in the case of an error
    // midway through reading a directory.
    //
    // If you must continue obtaining a list of [fs.FileInfo], you still can:
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  7. src/os/dir_unix.go

    		return &buf
    	},
    }
    
    func (d *dirInfo) close() {
    	if d.buf != nil {
    		dirBufPool.Put(d.buf)
    		d.buf = nil
    	}
    }
    
    func (f *File) readdir(n int, mode readdirMode) (names []string, dirents []DirEntry, infos []FileInfo, err error) {
    	// If this file has no dirInfo, create one.
    	d := f.dirinfo.Load()
    	if d == nil {
    		d = new(dirInfo)
    		f.dirinfo.Store(d)
    	}
    	d.mu.Lock()
    	defer d.mu.Unlock()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 20:11:45 UTC 2024
    - 4.8K bytes
    - Viewed (0)
Back to top