remove removing of hidden files, just ignore in Tree build
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Arnas Udovic 2023-06-29 00:05:26 +03:00
parent f0ffa78266
commit 7034e2aad8

34
tree.go
View file

@ -116,11 +116,6 @@ func PopulateTree(sourcePath string, meta []string, customMeta map[string]func()
var err error var err error
var attachmentRegistry map[string]string var attachmentRegistry map[string]string
err = removeHidden(sourcePath)
if err != nil {
return err
}
attachmentRegistry, err = moveAttachments(sourcePath) attachmentRegistry, err = moveAttachments(sourcePath)
if err != nil { if err != nil {
return err return err
@ -148,31 +143,6 @@ func PopulateTree(sourcePath string, meta []string, customMeta map[string]func()
return err 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) { func moveAttachments(dir string) (map[string]string, error) {
attachmentRegistry := make(map[string]string) attachmentRegistry := make(map[string]string)
@ -426,6 +396,10 @@ func readPath(dirPath string, category []string, meta []string) (Tree, error) {
} }
for _, file := range files { for _, file := range files {
if strings.HasPrefix(file.Name(), ".") {
continue
}
fullPath := path.Join(dirPath, file.Name()) fullPath := path.Join(dirPath, file.Name())
if file.IsDir() { if file.IsDir() {
if strings.HasPrefix(fullPath, fmt.Sprintf("%s/%s", clearDir, AttachmentDirName)) { if strings.HasPrefix(fullPath, fmt.Sprintf("%s/%s", clearDir, AttachmentDirName)) {