Commit fd84aa98 authored by Jeromy's avatar Jeromy

rename hidden field

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 0b97387e
...@@ -14,12 +14,12 @@ import ( ...@@ -14,12 +14,12 @@ import (
// No more than one file will be opened at a time (directories will advance // No more than one file will be opened at a time (directories will advance
// to the next file when NextFile() is called). // to the next file when NextFile() is called).
type serialFile struct { type serialFile struct {
name string name string
path string path string
files []os.FileInfo files []os.FileInfo
stat os.FileInfo stat os.FileInfo
current *File current *File
hidden bool handleHiddenFiles bool
} }
func NewSerialFile(name, path string, hidden bool, stat os.FileInfo) (File, error) { func NewSerialFile(name, path string, hidden bool, stat os.FileInfo) (File, error) {
...@@ -70,7 +70,7 @@ func (f *serialFile) NextFile() (File, error) { ...@@ -70,7 +70,7 @@ func (f *serialFile) NextFile() (File, error) {
stat := f.files[0] stat := f.files[0]
f.files = f.files[1:] f.files = f.files[1:]
for !f.hidden && strings.HasPrefix(stat.Name(), ".") { for !f.handleHiddenFiles && strings.HasPrefix(stat.Name(), ".") {
if len(f.files) == 0 { if len(f.files) == 0 {
return nil, io.EOF return nil, io.EOF
} }
...@@ -86,7 +86,7 @@ func (f *serialFile) NextFile() (File, error) { ...@@ -86,7 +86,7 @@ func (f *serialFile) NextFile() (File, error) {
// recursively call the constructor on the next file // 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 regular file, we will open it as a ReaderFile
// if it's a directory, files in it will be opened serially // if it's a directory, files in it will be opened serially
sf, err := NewSerialFile(fileName, filePath, f.hidden, stat) sf, err := NewSerialFile(fileName, filePath, f.handleHiddenFiles, stat)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment