This Technical Note explains how applications should find configuration and other application-related files.
Changes since September 1990: Lists new ways to access the @ prefix under System Software 6.0 and later.
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.
Starting with System Software 6.0, you can also retrieve the value of the @ prefix by passing $FFFF (-1) to GetPrefix. You may also set the value of the @ prefix by passing $FFFF to SetPrefix, but only applications or system-wide utilities should ever change the @ prefix. Specifically, any DAs, CDevs, initialization files or others should not mess with the @ prefix to make their own file handling simpler.
This and all of the other Apple II Technical Notes have been converted to HTML by Aaron Heiss as a public service to the Apple II community, with permission by Apple Computer, Inc. Any and all trademarks, registered and otherwise, are properties of their owners.