CiderPress2 icon indicating copy to clipboard operation
CiderPress2 copied to clipboard

Suppress adding invisible .DS_Store files

Open frankmilliron opened this issue 10 months ago • 2 comments

Hello! I use Ciderpress in a cross-platform setup, and I was wondering if CP2 could skip adding the invisible .DS_Store files.

frankmilliron avatar Feb 23 '25 05:02 frankmilliron

The .DS_Store files are created by the macOS Finder. They can be something of a nuisance.

I believe the current CP2 behavior mimics that of ZIP, so I don't think changing the default behavior is a good idea (based on the "principle of least surprise"). Anything that generally affects "invisible" files might also affect the ._ AppleDouble files that hold attributes and resource forks, so the new behavior would need to single the .DS_Store files out by name.

We could use a simple "no DS_Store" setting, or a general .gitignore-style exclusion list, set in the .cp2rc file.

Alternatively, it's possible to remove the files with wildcards, but you need to do it for each directory level, i.e. $ cp2 delete archive.zip "*.DS_Store" "*/*.DS_Store" "*/*/*.DS_Store" which is sort of cumbersome. You can also script it, e.g. $ cp2 list archive.zip | grep .DS_Store | tr \\n \\0 | xargs -0 cp2 delete archive.zip (this is why the list command exists... the tr command is needed in case directory names have spaces in them, and xargs -d may not work on macOS).

fadden avatar Feb 23 '25 16:02 fadden

Thanks for your response. Yes sometimes I just nuke them with a rm -rf ._* on the mac first. I had to mix around the image folder structure again anyway, so it wasn't a big deal to delete them. I was just surprised to see them there, as I don't recall running into it with CP1. I have my ZIP app on the mac also set to not include them, so a setting would be a nice addition, even if I have to dig into a text file. :)

frankmilliron avatar Feb 25 '25 19:02 frankmilliron