Q:  Is there a way to make a .wn-style document file package, so it appears to the user as a file rather than a directory? 

A:  A file package is a special kind of directory containing a set of related files that usually aren't accessed individually.  You can use a file package to hold a collection of files that make up one complete document, such as the text of a document and its imbedded graphic files.  A file package provides a convenient way to shield the files related to the application from the user; the package acts as though it were one document.  The Workspace Manager represents the package in the File Viewer by the document icon, and the Open command launches the application and opens the file rather than opening the directory.  

It is easy to make your own document file package, because a file package is simply a directory which ends with the extension your application claims for its documents.  In the InterfaceBuilder Project Attributes Inspector, you can associate a custom document icon with a file name extension.  (For Release 3, use the Attributes display in Project Builder.)  When you create a directory with that extension, the Workspace Manager displays it using your custom icon instead of the folder icon.  When a user double-clicks that icon, it launches your program and requests that it open that document/directory.  

When opening a document, your application should stat the file pathname to determine whether it is a file or a directory.  If it is a directory, you should probably open particular files within the directory and put together the complete document.  As an example, when WriteNow is opening a document package, it looks inside the directory for the file ªWNDocument.wnº.  This file contains the text of the document and also has pointers to the embedded graphic files which are also stored in the file package.

See also: 

../NEXTSTEP_Developer/Miscellaneous/registering_applications_with_workspace.rtf:  for information about registering your application with the Workspace.
	
QA701

Valid for 1.0, 2.0, 3.0