-
Notifications
You must be signed in to change notification settings - Fork 13
/
dir.go
40 lines (31 loc) · 664 Bytes
/
dir.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"io/ioutil"
"path/filepath"
"github.com/unidoc/unidoc/pdf/creator"
)
type DirSource struct {
path string
files []Mergeable
}
func (s DirSource) MergeTo(c *creator.Creator) error {
debugInfo(fmt.Sprintf("Adding Directory: %s", s.path))
var err error
for _, mergeableFile := range s.files {
err = mergeableFile.MergeTo(c)
if err != nil {
break
}
}
return err
}
func (s *DirSource) scanMergeables() {
filesInDir, _ := ioutil.ReadDir(s.path)
for _, file := range filesInDir {
if file.IsDir() {
continue
}
s.files = append(s.files, getMergeableFile(filepath.Join(s.path, file.Name()), []int{}))
}
}