file

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2020 License: MPL-2.0, MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFileAll

func CreateFileAll(name string, fileFlag int, filePerm, dirPerm os.FileMode) (*os.File, error)

CreateFileAll calls MkdirAll to ensure all intermediate directories exist prior to creation.

func Exists

func Exists(name string) (bool, os.FileInfo, error)

Exists checks if a file/directory exists.

func Readdir

func Readdir(dir string, max int) (files []os.FileInfo, err error)

func Readdirnames

func Readdirnames(dir string, max int) (names []string, err error)

func RemoveAllSafer

func RemoveAllSafer(p string) error

func RemoveSafer

func RemoveSafer(p string) error

func ValidateRemove

func ValidateRemove(p string) error

Types

type DirMatcher

type DirMatcher func(absName string, files FinderMatchFiles) (bool, error)

type DirToFinderMatchFiles

type DirToFinderMatchFiles map[string]FinderMatchFiles

DirToFinderMatchFiles indexes os.Readdir results by directory absolute path.

type FileMatcher

type FileMatcher func(candidate FinderFile) (bool, error)

type Finder

type Finder struct {
	// contains filtered or unexported fields
}

func NewFinder

func NewFinder() *Finder

func (*Finder) Clear

func (f *Finder) Clear() *Finder

func (*Finder) Dir

func (f *Finder) Dir(dirs ...string) *Finder

func (*Finder) DirMatcher

func (f *Finder) DirMatcher(matchers ...DirMatcher) *Finder

func (*Finder) GetDirMatches

func (f *Finder) GetDirMatches() (dirs []FinderFile, err error)

GetDirMatches walks the registered directories and returns a FinderFile element for each sub-directory which satisfies the matcher.

Each registered directory will be included if it also satisfies the matcher.

func (*Finder) GetDirnameMatches

func (f *Finder) GetDirnameMatches() (*cage_strings.Set, error)

GetDirnameMatches walks the registered directories and returns the absolute paths to all sub-directories which satisfy the matcher.

Each registered directory will be included if it also satisfies the matcher.

func (*Finder) GetFileMatches

func (f *Finder) GetFileMatches(fileMatchers ...FileMatcher) (DirToFinderMatchFiles, error)

func (*Finder) GetFileObjectMatches

func (f *Finder) GetFileObjectMatches(fileMatchers ...FileMatcher) (objs []FinderFile, err error)

func (*Finder) GetFilenameMatches

func (f *Finder) GetFilenameMatches(fileMatchers ...FileMatcher) (*cage_strings.Set, error)

func (*Finder) WalkHiddenDir

func (f *Finder) WalkHiddenDir(b bool) *Finder

type FinderFile

type FinderFile struct {
	AbsPath string
	Info    os.FileInfo
}

type FinderMatchFiles

type FinderMatchFiles map[string]FinderFile

FinderMatchFiles indexes FinderFile results by file absolute path.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL