diff --git a/tree.go b/tree.go index a553d56..4ffc65e 100644 --- a/tree.go +++ b/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)) {