diff --git a/.gx/lastpubver b/.gx/lastpubver deleted file mode 100644 index cf7cad5..0000000 --- a/.gx/lastpubver +++ /dev/null @@ -1 +0,0 @@ -2.0.7: QmRHcZ5ngUxZo8phLR3fpoqk9wA7VdGc5mhwkGSnB2nZ9F diff --git a/.travis.yml b/.travis.yml index 5163d69..936d6a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: language: go go: - - 1.11.x + - 1.14.x env: global: diff --git a/serialfile.go b/serialfile.go index fbb7a29..f56fcc6 100644 --- a/serialfile.go +++ b/serialfile.go @@ -3,15 +3,13 @@ package files import ( "errors" "fmt" - "io" "io/ioutil" "os" "path/filepath" ) // serialFile implements Node, and reads from a path on the OS filesystem. -// No more than one file will be opened at a time (directories will advance -// to the next file when NextFile() is called). +// No more than one file will be opened at a time. type serialFile struct { path string files []os.FileInfo @@ -53,7 +51,7 @@ func NewSerialFileWithFilter(path string, filter *Filter, stat os.FileInfo) (Nod return NewReaderPathFile(path, file, stat) case mode.IsDir(): // for directories, stat all of the contents first, so we know what files to - // open when NextFile() is called + // open when Entries() is called contents, err := ioutil.ReadDir(path) if err != nil { return nil, err @@ -124,38 +122,6 @@ func (f *serialFile) Entries() DirIterator { } } -func (f *serialFile) NextFile() (string, Node, error) { - // if there aren't any files left in the root directory, we're done - if len(f.files) == 0 { - return "", nil, io.EOF - } - - stat := f.files[0] - f.files = f.files[1:] - - for !f.filter.ShouldExclude(stat) { - if len(f.files) == 0 { - return "", nil, io.EOF - } - - stat = f.files[0] - f.files = f.files[1:] - } - - // open the next file - filePath := filepath.ToSlash(filepath.Join(f.path, stat.Name())) - - // recursively call the constructor on the next file - // if it's a regular file, we will open it as a ReaderFile - // if it's a directory, files in it will be opened serially - sf, err := NewSerialFileWithFilter(filePath, f.filter, stat) - if err != nil { - return "", nil, err - } - - return stat.Name(), sf, nil -} - func (f *serialFile) Close() error { return nil }