Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 107 for Readdir (0.42 sec)

  1. src/io/fs/readdir.go

    // that provides an optimized implementation of [ReadDir].
    type ReadDirFS interface {
    	FS
    
    	// ReadDir reads the named directory
    	// and returns a list of directory entries sorted by filename.
    	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.
    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

    func (f *File) Readdir(n int) ([]FileInfo, error) {
    	if f == nil {
    		return nil, ErrInvalid
    	}
    	_, _, infos, err := f.readdir(n, readdirFileInfo)
    	if infos == nil {
    		// Readdir has historically always returned a non-nil empty slice, never nil,
    		// even on error (except misuse with nil receiver above).
    		// Keep it that way to avoid breaking overly sensitive callers.
    		infos = []FileInfo{}
    	}
    	return infos, err
    }
    
    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/os/dir_plan9.go

    			d.bufp, d.nbuf = 0, nb
    
    			if err != nil {
    				if err == io.EOF {
    					break
    				}
    				return names, dirents, infos, &PathError{Op: "readdir", Path: file.name, Err: err}
    			}
    			if nb < syscall.STATFIXLEN {
    				return names, dirents, infos, &PathError{Op: "readdir", Path: file.name, Err: syscall.ErrShortStat}
    			}
    		}
    
    		// Get a record from the buffer.
    		b := d.buf[d.bufp:]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 15 20:52:06 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  4. src/testing/fstest/testfs.go

    			t.errorf("%s: third Open: ReadDir(%d) after %d: 0 entries but nil error", dir, n, len(list2))
    			return
    		}
    	}
    	t.checkDirList(dir, "first Open+ReadDir(-1) vs third Open+ReadDir(1,2) loop", list, list2)
    
    	// If fsys has ReadDir, check that it matches and is sorted.
    	if fsys, ok := t.fsys.(fs.ReadDirFS); ok {
    		list2, err := fsys.ReadDir(dir)
    		if err != nil {
    			t.errorf("%s: fsys.ReadDir: %w", dir, err)
    			return
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 16.3K bytes
    - Viewed (0)
  5. src/io/fs/fs.go

    	//
    	// If n > 0, ReadDir returns at most n DirEntry structures.
    	// In this case, if ReadDir returns an empty slice, it will return
    	// a non-nil error explaining why.
    	// At the end of a directory, the error is io.EOF.
    	// (ReadDir must return io.EOF itself, not an error wrapping io.EOF.)
    	//
    	// If n <= 0, ReadDir returns all the DirEntry values from the directory
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 15 21:21:41 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  6. src/io/fs/walk.go

    // attempted and has err set to nil, giving the function a chance to
    // return [SkipDir] or [SkipAll] and avoid the ReadDir entirely. The second call
    // is after a failed ReadDir and reports the error from ReadDir.
    // (If ReadDir succeeds, there is no second call.)
    //
    // The differences between WalkDirFunc compared to [path/filepath.WalkFunc] are:
    //
    //   - The second argument has type [DirEntry] instead of [FileInfo].
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 09 08:50:19 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  7. src/os/read_test.go

    	}
    }
    
    func TestReadDir(t *testing.T) {
    	t.Parallel()
    
    	dirname := "rumpelstilzchen"
    	_, err := ReadDir(dirname)
    	if err == nil {
    		t.Fatalf("ReadDir %s: error expected, none found", dirname)
    	}
    
    	dirname = "."
    	list, err := ReadDir(dirname)
    	if err != nil {
    		t.Fatalf("ReadDir %s: %v", dirname, err)
    	}
    
    	foundFile := false
    	foundSubDir := false
    	for _, dir := range list {
    		switch {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 10 02:36:46 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  8. src/io/ioutil/ioutil.go

    	return os.WriteFile(filename, data, perm)
    }
    
    // ReadDir reads the directory named by dirname and returns
    // a list of fs.FileInfo for the directory's contents,
    // sorted by filename. If an error occurs reading the directory,
    // ReadDir returns no directory entries along with the error.
    //
    // Deprecated: As of Go 1.16, [os.ReadDir] is a more efficient and correct choice:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  9. src/internal/poll/fd_wasip1.go

    	return syscall.Chdir(fd.Path)
    }
    
    // ReadDir wraps syscall.ReadDir.
    // We treat this like an ordinary system call rather than a call
    // that tries to fill the buffer.
    func (fd *FD) ReadDir(buf []byte, cookie syscall.Dircookie) (int, error) {
    	if err := fd.incref(); err != nil {
    		return 0, err
    	}
    	defer fd.decref()
    	for {
    		n, err := syscall.ReadDir(fd.Sysfd, buf, cookie)
    		if err != nil {
    			n = 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 20:14:02 UTC 2024
    - 6.7K bytes
    - Viewed (0)
  10. src/os/dir_unix.go

    			if IsNotExist(err) {
    				// File disappeared between readdir and stat.
    				// Treat as if it didn't exist.
    				continue
    			}
    			if err != nil {
    				return nil, dirents, nil, err
    			}
    			dirents = append(dirents, de)
    		} else {
    			info, err := lstat(f.name + "/" + string(name))
    			if IsNotExist(err) {
    				// File disappeared between readdir + stat.
    				// Treat as if it didn't exist.
    				continue
    			}
    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