lgarron / folderify

:file_folder: Generate pixel-perfect macOS folder icons in the native style.
MIT License
1.56k stars 39 forks source link

Improve test #51

Closed craig65535 closed 3 years ago

craig65535 commented 3 years ago

Check for folder/icon attributes, beyond just checking for existence.

This could be improved later by actually parsing out the attributes:

$ xattr -l -p com.apple.FinderInfo .
com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020

(The 04 byte means "custom icon").

There is a GetFileInfo tool that could be used for that, but it's not clear to me that it will always be available.

$ GetFileInfo . | grep -E ^attributes
attributes: avbstClinmedz

(C is for "custom icon")

Anyway, I think just checking for the existence of these attributes is an improvement in itself.

craig65535 commented 3 years ago

@lgarron would you be able to start the CI workflow on this PR? Thank you

craig65535 commented 3 years ago

I could improve this further by committing some hex dump files with the expected FinderInfo for both the folder and the icon, and diffing the two in the test script, but I thought this was a good starting point.

craig65535 commented 3 years ago

@lgarron Will this revised change work? Also, I still need CI workflow run on this PR. Thanks again

lgarron commented 3 years ago

Sorry for the delay. Looks good, thanks!

I think ideally we would also test that the expected attributes are not present on a folder before we folderify it, but I don't know if that would actually help us ever detect bugs in practice.