Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
i've noticed that NSFileManager has an attribute to hide the files extension, but what if i want to make the whole file hidden?

i understand i could simply add a "." to the beginning of the file name, but how are hidden files written that don't have "." at the beginning of their name? i read somewhere it has to do with setting the hidden attribute in the resource fork of the file, but how can i access/set that resource fork from my cocoa app?
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I've been reading for quite a while since I read your question... and it doesn't seem like there is a Cocoa way to do this. There is a pair of calls, getattrlist and setattrlist that seem to do this, but I cannot find any real example on how to do this. These get called by SetFile when you run it with -a V <filename> (I found this with ktrace/kdump). They're called through some carbon calls, namely:
http://developer.apple.com/document...ence.html#//apple_ref/c/func/FSSetCatalogInfo
(found this breaking on getattrlist and setattrlist in gdb and doing a backtrace)

I don't think there is a Cocoa way to do this.

Maybe there's a different tact you can take? Put the file in an already hidden directory?

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.