rename hidden field
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Dec 28, 2015 at 11:23 UTC
cd1e38936016b7163fc504cb8fe0a79fab2b6378
1 file changed
+8
-8
commands/files/serialfile.go
+8
-8
@@ -14,12 +14,12 @@ import (
14
// No more than one file will be opened at a time (directories will advance
15
// to the next file when NextFile() is called).
16
type serialFile struct {
17
- name string
18
- path string
19
- files []os.FileInfo
20
- stat os.FileInfo
21
- current *File
22
- hidden bool
17
+ name string
18
+ path string
19
+ files []os.FileInfo
20
+ stat os.FileInfo
21
+ current *File
22
+ handleHiddenFiles bool
23
}
24
25
func NewSerialFile(name, path string, hidden bool, stat os.FileInfo) (File, error) {
@@ -70,7 +70,7 @@ func (f *serialFile) NextFile() (File, error) {
70
stat := f.files[0]
71
f.files = f.files[1:]
72
73
- for !f.hidden && strings.HasPrefix(stat.Name(), ".") {
73
+ for !f.handleHiddenFiles && strings.HasPrefix(stat.Name(), ".") {
74
if len(f.files) == 0 {
75
return nil, io.EOF
76
}
@@ -86,7 +86,7 @@ func (f *serialFile) NextFile() (File, error) {
86
// recursively call the constructor on the next file
87
// if it's a regular file, we will open it as a ReaderFile
88
// if it's a directory, files in it will be opened serially
89
- sf, err := NewSerialFile(fileName, filePath, f.hidden, stat)
89
+ sf, err := NewSerialFile(fileName, filePath, f.handleHiddenFiles, stat)
90
if err != nil {
91
return nil, err
92
}