50 ms·
I had to write a one-liner to deal with that on Mac OS 10.4 -- had to detect if a user had placed anything on their Desktop, which had a custom folder icon beca
by blasdel 17y ago
I had to write a one-liner to deal with that on Mac OS 10.4 -- had to detect if a user had placed anything on their Desktop, which had a custom folder icon because it was actually a cross-filesystem symlink:
desktop=$(test -z $(ls -A1 /Volumes/Documents/Desktop | \
sed -e '/^.DS_Store$/d' -e '/^Icon^M$/d'))
The ^M was a literal CR, which would get munged by all my usual editors except vim. I'm sure there's some sturdier way to escape it...
I remember choosing to use ls intentionally, but not what sucked about the alternatives.