Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'These are the Type and Creator codes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
These are the Type and Creator codes
Authored by: radiola on Jan 14, '10 10:57:16AM

What you're doing with xattr is setting the file's 4-character Type and Creator codes, in kind of a backwards way. The first four characters (TEXT) are the file type, the second four (!Rch) are the creator.

TEXT is the standard type code for a text file. In fact, on my Leopard system, all you need to do is set is the type, not the creator. I don't know if that can be done safely with xattr — I recommend SetFile from XCode Tools, or any other utility that is designed to manipulate type and creator info.

Interestingly, TextWrangler already sets this attribute with the 'correct' value, SubEthaEdit and TextEdit do not.

TextWranger sets it "correctly" because !Rch is TextWrangler's own creator code! Again, in my testing, only the TEXT type code must be set; the creator code doesn't matter, and can be missing.



[ Reply to This | # ]
These are the Type and Creator codes
Authored by: hamarkus on Jan 14, '10 01:19:39PM

Good to know. So the more general version of this hint would be to simply set the type code to TEXT, with the additional information that the type codeis stored as an extended attribute under com.apple.FinderInfo. Multiple tools exist for setting that that, one of that being xattr another setfile (not sure where both are available if Xcode is not installed).

In one sense, xattr is the more general method since the information is stored as an extended attribute. In another sense, setfile is more direct method since it calls this setting by its commonly known name (type).



[ Reply to This | # ]