home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-11 | 1.5 KB | 38 lines | [TEXT/MMCC] |
- // View this file in Geneva 9 with 4 space tabs.
- // This code was written by François Pottier (pottier@dmi.ens.fr) and compiled with CodeWarrior 4.5. You can use it freely.
- // The code assumes System 7.
-
- #pragma once
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*
- Locate a file based on its type and creator. It is safer than using a file name : users have this distressing habit of renaming files.
-
- The routine looks for the file in the system subfolder specified by 'where', typically the Preferences folder or the Extensions folder.
- The first file with the corresponding type and creator is considered a match.
-
- If the file is found, its FSSpec is returned and 'wasAbsent' is set to false.
- If the file doesn't exist, it is (optionally) created using FSpCreateResFile and the supplied type, creator and name. 'wasAbsent' is set
- to true. An FSSpec is also returned. If desired, the routine can copy the application's 'vers' 2 resource into the file. This is useful
- for preferences files.
-
- If you don't care about 'wasAbsent', pass NULL.
- */
-
- OSErr LocateFile ( OSType where, // Folder code, to be passed to FindFolder
- OSType fdType, // Desired type and creator
- OSType fdCreator,
- short strFileName, // 'STR ' resource ID for the default name
- FSSpec *spec, // Resulting file specification
- Boolean create, // If true, the file will be created if missing
- Boolean *wasAbsent, // true if the file didn't exist
- Boolean copyVers // If true, copy our 'vers' 2 resource into the new file
- );
-
- #ifdef __cplusplus
- }
- #endif
-