• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa & File Attributes Confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Cocoa & File Attributes Confusion
      • From: email@hidden
    • Re: Cocoa & File Attributes Confusion
      • From: Ondra Cada <email@hidden>
    • Re: Cocoa & File Attributes Confusion
      • From: John Nestor <email@hidden>
References: 
 >Cocoa & File Attributes Confusion (From: Matt Ronge <email@hidden>)

  • Prev by Date: Re: about help
  • Next by Date: Re: NSView's DrawRect
  • Previous by thread: Cocoa & File Attributes Confusion
  • Next by thread: Re: Cocoa & File Attributes Confusion
  • Index(es):
    • Date
    • Thread