New Resource Manager Calls

Technote TB 16October 1988

Written by: Andrew Shebanow October 1988

This Technical Note describes two new Resource Manager calls that make opening and creating resource files much easier.

MPW 3.0 supplies glue routines for two new Resource Manager calls which provide new, easier ways of opening and creating resource files.

The important thing about these two calls is that they allow you to pass a directory ID instead of a working directory refNum. This means that you can create a resource file without worrying about the Poor Man's Search Path (PMSP). If you try to create a file using _CreateResFile, and there is already a resource file with the same name in the System Folder (or in any other folder that is on the PMSP's list), the _CreateResFile call will not work because the Resource Manager thinks the resource file already exists. The all new HCreateResFile glue does not use the PMSP if you specify a non-zero directory ID.

			dirID: LONGINT;
			fileName: Str255;
			permission: SignedByte): INTEGER;

The HOpenResFile routine opens an existing resource file in the directory specified by vRefNum and dirID and it returns the refNum of the resource file. If the refNum equals -1, you should call _ResError to check for errors. This routine also lets you open a resource file without creating a working directory.

	fileName: Str255);

The HCreateResFile routine creates a new resource file with name fileName in the directory specified by vRefNum and dirID. You should call _ResError to check for errors.

Previous Technote | Contents | Next Technote