remove removing of hidden files, just ignore in Tree build
This commit is contained in:
parent
f0ffa78266
commit
7034e2aad8
1 changed files with 4 additions and 30 deletions
34
tree.go
34
tree.go
|
@ -116,11 +116,6 @@ func PopulateTree(sourcePath string, meta []string, customMeta map[string]func()
|
|||
var err error
|
||||
var attachmentRegistry map[string]string
|
||||
|
||||
err = removeHidden(sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
attachmentRegistry, err = moveAttachments(sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -148,31 +143,6 @@ func PopulateTree(sourcePath string, meta []string, customMeta map[string]func()
|
|||
return err
|
||||
}
|
||||
|
||||
func removeHidden(dir string) error {
|
||||
var toRemovePaths []string
|
||||
|
||||
err := filepath.Walk(dir, func(fullPath string, info os.FileInfo, e error) error {
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
|
||||
if strings.HasPrefix(info.Name(), ".") {
|
||||
toRemovePaths = append(toRemovePaths, fullPath)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
for _, removePath := range toRemovePaths {
|
||||
e := os.RemoveAll(removePath)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func moveAttachments(dir string) (map[string]string, error) {
|
||||
attachmentRegistry := make(map[string]string)
|
||||
|
||||
|
@ -426,6 +396,10 @@ func readPath(dirPath string, category []string, meta []string) (Tree, error) {
|
|||
}
|
||||
|
||||
for _, file := range files {
|
||||
if strings.HasPrefix(file.Name(), ".") {
|
||||
continue
|
||||
}
|
||||
|
||||
fullPath := path.Join(dirPath, file.Name())
|
||||
if file.IsDir() {
|
||||
if strings.HasPrefix(fullPath, fmt.Sprintf("%s/%s", clearDir, AttachmentDirName)) {
|
||||
|
|
Loading…
Reference in a new issue