Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for FormatDirEntry (0.59 sec)

  1. src/io/fs/format_test.go

    		}
    	}
    }
    
    func TestFormatDirEntry(t *testing.T) {
    	for i, test := range formatTests {
    		got := FormatDirEntry(&test.input)
    		if got != test.wantDirEntry {
    			t.Errorf("%d: FormatDirEntry(%#v) = %q, want %q", i, test.input, got, test.wantDirEntry)
    		}
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 02 17:59:28 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  2. src/io/fs/format.go

    	if info.IsDir() {
    		b = append(b, '/')
    	}
    
    	return string(b)
    }
    
    // FormatDirEntry returns a formatted version of dir for human readability.
    // Implementations of [DirEntry] can call this from a String method.
    // The outputs for a directory named subdir and a file named hello.go are:
    //
    //	d subdir/
    //	- hello.go
    func FormatDirEntry(dir DirEntry) string {
    	name := dir.Name()
    	b := make([]byte, 0, 5+len(name))
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 18 19:34:35 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  3. src/os/dir_plan9.go

    func (de dirEntry) Type() FileMode          { return de.fs.Mode().Type() }
    func (de dirEntry) Info() (FileInfo, error) { return de.fs, nil }
    
    func (de dirEntry) String() string {
    	return fs.FormatDirEntry(de)
    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/io/fs/readdir.go

    }
    
    func (di dirInfo) Info() (FileInfo, error) {
    	return di.fileInfo, nil
    }
    
    func (di dirInfo) Name() string {
    	return di.fileInfo.Name()
    }
    
    func (di dirInfo) String() string {
    	return FormatDirEntry(di)
    }
    
    // FileInfoToDirEntry returns a [DirEntry] that returns information from info.
    // If info is nil, FileInfoToDirEntry returns nil.
    func FileInfoToDirEntry(info FileInfo) DirEntry {
    	if info == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  5. src/os/dir_windows.go

    func (de dirEntry) Type() FileMode          { return de.fs.Mode().Type() }
    func (de dirEntry) Info() (FileInfo, error) { return de.fs, nil }
    
    func (de dirEntry) String() string {
    	return fs.FormatDirEntry(de)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 15 20:52:06 UTC 2024
    - 7.7K bytes
    - Viewed (0)
Back to top