Re: Cocoa & File Attributes Confusion
Re: Cocoa & File Attributes Confusion
- Subject: Re: Cocoa & File Attributes Confusion
- From: "Clark S. Cox III" <email@hidden>
- Date: Sun, 10 Feb 2002 16:01:50 -0500
On Sunday, February 10, 2002, at 02:10 , Matt Ronge wrote:
I've been working with files and getting their attributes and I am getting
very confused.
Can someone outline the differences between NSFileManager, NSFileHandler
I assume you mean NSFileHandle
and
NSWorkSpace for me? Because I have looked at each of them and they all
seem
to do the same things! Why isn't there a single NSFileManager that does
everything instead of all this stuff scattered around.
I'm very inclined to say RTFM, as there's virtually *no* overlap between
the functionalities of these three classes, but here's a quick breakdown,
'cause I'm feeling nice.
NSFileManager - Use this to move files, copy files, delete files,
check if files exist, and get the attributes of files.
NSFileHandle - An object of NSFileHandle is used to read and
write data to and from a file (or other stream, such as stdin, stdout,
stderr, etc.).
NSWorkspace - Part of the AppKit Framework (i.e. can *not* be
used in Command-Line tools). Objects of this class are used to open files
(as if they were double-clicked in the finder, or dragged to a specific
application), launch other applications, get icons representing files, and
deal with mounted volumes.
Why are there so many ways to find a files icon for example.
There's only one way that I can see:
NSImage *icon = [ [ NSWorkspace sharedWorkspace ] iconForFile:
filePath ];
Or move a file?
Again, there's only one way that I can see:
BOOL succeeded = [ [ NSFileManager defaultManager ] movePath: src
toPath: dest handler: handler ]
I'm confused.
Also, I can't figure out how to get a files creation date in Cocoa, huh?
How
is this done?
To be honest, I'm not sure.
--
Clark S. Cox, III
email@hidden
http://www.whereismyhead.com/clark/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.