The GUI approach to attaching an icon to an OS X object is
a. copy an image file in icns format into the clipboard,
b. select the object
c. press Command-I (Get Info),
d. select the icon image at the top left corner of the Get Info pane and paste.
Below is an exposition of the alternative command-line approach to attaching an icon.
When applying the GUI approach, what happens in the background? Where does the Finder store this image for future recall? As opposed to OS X, in Unix, a file is a stream of bytes, an unstructured object. In OS X, a file is broke into a structure of "forks": data fork, resource fork, etc. The file data is what's in the data fork, while the resource fork contains additional data such as the icon image file, and a flag alerting Finder that the file has a custom icon.
How then does OS X deal with foreign file systems such as Unix or NTFS typically presented as network volumes? In other words, suppose you attach (using the GUI approach) an icon to the file ~/filename on a Unix volume that is mounted as a Samba share. Since the Unix volume cannot host resource forks, for consistency OS X creates the "dot-underscore" file ._filename in the same folder containing filename and places the resource fork data in there. For example, changing the icon for ~/public_html creates the file ~/._public_html.
Similarly, when you attach (using the GUI approach) an icon to a network volume, OS X creates the file ._. in the root folder of the volume (since . is Unix's self-dir and the root folder has no parent), and places the icon image file as the file .VolumeIcon.icns in the root folder of the volume. The file ._. contains only the custom icon flag and is small and is universal, ie independent of the volume or the mount point. Actually, the network folder's root does have a parent, /Volumes, and it is more consistent with the previous paragraph to create ._* inside there, alongside the mount point. This is in fact what the CUSTOM_VOLUME_ICON URL above describes, and this may have been the way OS X did things 5 years ago, but is no longer so.
Thus, if you've set up a remote folder to show up with a specific icon when mounted, to do so for another remote folder involves copying over the two files ._. and
.VolumeIcon.icns. To change the icon image, create a new icns file and copy it over to .VolumeIcon.icns. Then make Finder aware of the custom icon by restarting Finder.
I incorporated these steps in a simple GUI front-end for sshfs, that Mac users who've never touched Terminal can use:
https://it.cst.temple.edu/~it/sshfs/
--
You received this message because you are subscribed to the Google Groups "OSXFUSE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osxfuse-grou...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.