13. Accessing Directories and Files
If you’re using AppKit, you have two options for most filesystem-related tasks. The
NSFileManager class, from the Foundation framework, provides a lot of low-level methods for manipulating files and directories. The
NSWorkspace class from the Application Kit provides more abstract forms.
A number of the functions of
NSWorkspace are delegated to the workspace process. On old NeXT systems, this was a single program, whereas on OS X, various bits of its functionality are implemented by the window server and the Finder.
Because of this, it doesn’t make sense to think about using the higher-level versions when the workspace process is not guaranteed to be present—for example, in command-line tools that might be ...