Ignore macOS files, issue #37

This commit is contained in:
Milan Nikolic
2024-11-06 18:31:22 +01:00
parent 31e1c94f70
commit f85fe990ff

View File

@@ -11,6 +11,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"sync/atomic"
"github.com/gen2brain/avif"
@@ -166,9 +167,15 @@ func (c *Converter) convertArchive(ctx context.Context, fileName string) error {
return c.imageConvert(ctx, img, 0, pathName)
})
}
} else if !c.Opts.NoNonImage {
if err = copyFile(bytes.NewReader(data), filepath.Join(c.Workdir, filepath.Base(pathName))); err != nil {
return fmt.Errorf("convertArchive: %w", err)
} else {
if filepath.Ext(pathName) == ".DS_Store" || strings.Contains(pathName, "__MACOSX") {
continue
}
if !c.Opts.NoNonImage {
if err = copyFile(bytes.NewReader(data), filepath.Join(c.Workdir, filepath.Base(pathName))); err != nil {
return fmt.Errorf("convertArchive: %w", err)
}
}
}
}