Important: The information in this document is obsolete and should not be used for new development.
GetResFileAttrs
You can use theGetResFileAttrsfunction to get the attributes of a resource fork.
FUNCTION GetResFileAttrs (refNum: Integer): Integer;
refNum- A file reference number for the resource fork whose attributes you want to get.
DESCRIPTION
Given a file reference number, theGetResFileAttrsfunction returns the attributes of the file's resource fork. Specify 0 in therefNumparameter to get the attributes of the System file's resource fork. If there's no open resource fork for the given file reference number,GetResFileAttrsdoes nothing, and theResErrorfunction returns the result coderesFNotFound.Like individual resources, resource forks have attributes that are specified by bits in the low-order byte of a word. The Resource Manager provides the following masks for testing these bits:
CONST mapReadOnly = 128; {set if file is read-only} mapCompact = 64; {set to compact file on update} mapChanged = 32; {set to write map on update}When themapReadOnlyattribute is set to 1, the Resource Manager doesn't write anything to the resource fork on disk. It also doesn't check whether the resource data can be written to disk when the resource map is modified. When this attribute is set to 1, theUpdateResFileandWriteResourceprocedures do nothing, but theResErrorfunction returns the result codenoErr.When the
mapCompactattribute is set to 1, the Resource Manager compacts the resource fork when it updates the file. The Resource Manager sets this attribute when a resource is removed or when a resource is made larger and thus must be written at the end of a resource fork. You may want to set themapCompactattribute to force the Resource Manager to compact a resource fork when your changes have made resources smaller.When the
mapChangedattribute is set to 1, the Resource Manager writes the resource map to disk when the file is updated. For example, you can setmapChangedif you've changed resource attributes only and don't want to callChangedResourcebecause you don't want to write the resource data to disk.SPECIAL CONSIDERATIONS
The Resource Manager sets themapChangedattribute for the resource fork when you call theChangedResource, theAddResource, or theRemoveResourceprocedure.RESULT CODES
noErr 0 No error resFNotFound -193 Resource file not found SEE ALSO
To check for errors, call theResErrorfunction as described on page 1-47.For descriptions of the
ChangedResourceandAddResourceprocedures, see page 1-83 and page 1-85, respectively. For descriptions of theUpdateResFileandWriteResourceprocedures, see page 1-87 and page 1-88, respectively. For a description of theRemoveResourceprocedure, see page 1-103.