[OS X TeX] Icons for .tex files became generic doc type
P.Vamos at exeter.ac.uk
Thu Sep 18 15:51:34 EDT 2014
The case of the disappearing icons is a recurring theme in this forum, I posted about it back in 2012, see appended messages (I) and (II). In this post there is a possible solution and a mystery to be solved.
Let me summarize the situation on my two machines: Snow Leopard and Mavericks as described in post (I) below, nothing changed since 2012.
(1) I have folders where I see the TS LaTeX icon, in all sizes, let’s call these iconic folders;
(2) I have also folders where I only see the generic icon, let’s call these iconless. *But* when I set the slider (bottom right of the window) controlling the size of the icon in an iconless folder to min then the icons appear!
(3) When I move a .tex TS file from and iconless to an iconic folder its icon appears.
The above suggest that the enclosing iconic folder can force (?) the appearance of a reluctant icon at least in my setup. What is iconic’s secret sauce? It turns out that an iconic folder has the Extended Attribute @ set (this isn’t the same as ACL); for the details see post (I) below. Moreover, the following solutions now offer themselves:
(i) If you have an iconic folder use this as a template and replace your iconless folder with a copy of it, see post (II) below for instructions.
(ii) If you know how to set an Extended Attribute then you can do this to your iconless folder; I tried this in 2012 without success maybe the UNIX savvy people on this forum can tell us how to do it.
(iii) If none of the above applies to you then go and download from my dropbox
an iconic folder with a sample TS file, if you can see the icon on your machine then the Extended Attribute survived and you can use solution (i). I would like to know if anyone succeded with any one of the solutions above.
++++++++++++++ (I) posted 4 June 2012 +++++++++++++++
On my desktop iMac Snow Leopard system my TexShop owned .tex files exhibit the following behaviour. (My Lion laptop seems identical.)
Of the four folder views I see the TS icon in all *except* in icon view so this is what I will report on below.
I have folders where I see the TS LaTeX icon, let's call them iconic folders and in others I only see the generic icon let's call these iconless. Moving a .tex file between these folders the icon appears/disappears depending on the enclosing folder. I tried the remedies suggested in this and in a previous thread and they had no effect on this behaviour. But here is the (first) strange thing: when I set the slider controlling the size of the icon in an iconless folder to min then the icons appear! Nudging the slider to the right, one can see a point where the icon changes to generic. This does not happen in an iconic folder. So it seems that (on my system at least) this behaviour is determined by some property of the enclosing folder.
Get info shows that the permissions differ on these two kinds of folder.
Iconless: group (staff/wheel) read only, everyone read only; Iconic: both group and everyone is set to `Custom' (???).
Going to terminal reveals more (ls -l).
Iconless: drwxr-xr-x Iconic: drwxrw-rw-@
Notice the @ at the end of the Iconic. This means that iconic folders have an xattr (Extended Attribute) set. This, I believe, came in with Tiger. So what is this attribute? Issuing the ls -l@ command gives nothing new for iconless of course but reports for Iconic (for the folder named charalg):
drwxrw-rw-@ 26 peterv staff 884 3 Jun 00:58 charalg
So the attribute's name is com.apple.FinderInfo and it is 32 bits long. You can get the value of this using getxattr. (I also noticed that some files have the com.apple.ResourceFork attribute.)
All this suggests to me the following hack/patch: set the xattr of an Iconless folder to that of an Iconic to make the latter Iconic. There is in fact an example on how to do this in the man pages for Lion only using xattr - presumably you could do it in Snow leopard with setxattr and getxattr. I tried the example on my Lion laptop but got error messages. At this stage my time and patience ran out - maybe someone more knowledgable/competent with Unix and the terminal can try to verify this conjecture.
All the above still leave the following questions:
How did my Iconic folders get their extended attributes in the first place? (Pre Tiger legacy folders?)
Why do TS icons need the folder to have this extended attribute (at least on my set-up)?
======== (II) workaround post 4 June 2012 ===========
OK here is a workaround without using terminal or indeed knowing anything about extended attributes. Assuming that you are plagued by the behaviour I described in my first posting in this thread even after you rebuilt the launch database etc *and* are sufficiently bothered by this (I am not sure that I am, i was just intrigued by this) then you can do the following.
Suppose that you have an Iconless folder F and an Iconic folder T(emplate). The idea is that the Duplicate command preserves extended attributes. So do
1) Duplicate folder T to get Td and delete the content of Td;
2) move content of folder F into folder Td;
3) delete folder F;
4) move folder Td to where folder F was and rename folder Td to the name of folder F.
You could do step 1) to create an empty Iconic folder and duplicate this every time you want a new Iconic folder for TS files. Applescript anyone?
Until Dick comes up with something better this will do for perfectionists I suppose.
More information about the MacOSX-TeX