Apple II
Technical Notes
_____________________________________________________________________________
                                                  Developer Technical Support

GS/OS
#10:    How Applications Find Their Files

Revised by:    Dave Lyons                                      September 1990
Written by:    Dave Lyons                                        January 1990

This Technical Note explains how applications should find configuration and 
other application-related files.
Changes since January 1990:  Stated explicitly that the @ prefix is useful 
only to applications.
_____________________________________________________________________________

When an application is launched, GS/OS sets prefix 9 to the application's 
parent directory.  It also sets prefix 1 to the same directory if the length 
of the pathname is within a 64-character limit.  It does not set prefix 0 to 
any special value.

If your application uses a partial pathname and depends upon prefix 0 to find 
files at the same directory level, it may be working by accident (prefix 0 is 
accidently set to the right directory), and sooner or later it won't work.

If your application needs to load a file named TitleScreen, the best way is to 
use the pathname 9:TitleScreen.  If you just use TitleScreen, you are using 
prefix 0, and you may or may not be looking in the right directory.

Files storing user-specific data should be stored in the at sign (@) prefix--
this is just like prefix 9, except that it is set to the user's user folder on 
an AppleShare server if the application was launched from a server.  Use 
@:MySettings rather than 9:MySettings or MySettings.  (If you want to retrieve 
the value of the @ prefix, you can call ExpandPath on the pathname "@:".)  
Note that the @ prefix was introduced in System Software 5.0.

The @ prefix is useful only for applications, not for Desk Accessories, CDevs, 
initialization files, or anything else; this type of code can get the path of 
the user's folder by using the AppleShare FST's FST-Specific call GetUserPath.


Further Reference
_____________________________________________________________________________
  o  GS/OS Reference
  o  AppleTalk Technical Note #8, Using the @ Prefix

