...

Source file src/github.com/sagikazarmark/locafero/file_type.go

Documentation: github.com/sagikazarmark/locafero

     1  package locafero
     2  
     3  import "io/fs"
     4  
     5  // FileType represents the kind of entries [Finder] can return.
     6  type FileType int
     7  
     8  const (
     9  	FileTypeAll FileType = iota
    10  	FileTypeFile
    11  	FileTypeDir
    12  )
    13  
    14  func (ft FileType) matchFileInfo(info fs.FileInfo) bool {
    15  	switch ft {
    16  	case FileTypeAll:
    17  		return true
    18  
    19  	case FileTypeFile:
    20  		return !info.IsDir()
    21  
    22  	case FileTypeDir:
    23  		return info.IsDir()
    24  
    25  	default:
    26  		return false
    27  	}
    28  }
    29  

View as plain text