/*============================================================*/
/*============================================================*/
/*==														==*/
/*==				File Error Handling File				==*/
/*==														==*/
/*============================================================*/
/*============================================================*/


/*========================================================  Includes  */

#include "UnivUtilities.h"
#include "FileError.h"


/*========================================================  CheckFileError  */

Boolean CheckFileError (short resultCode, StringPtr fileName)

{
	short			dummyInt, stringIndex;
	Str255			errMessage, errNumString;
	
	if (resultCode == noErr)		/* No problems?  Then cruise */
	{
		return(TRUE);
	}
	
	switch (resultCode)
	{
		case dirFulErr:
			stringIndex = 2;
			break;
		case dskFulErr:
			stringIndex = 3;
			break;
		case ioErr:
			stringIndex = 4;
			break;
		case bdNamErr:
			stringIndex = 5;
			break;
		case fnOpnErr:
			stringIndex = 6;
			break;
		case mFulErr:
			stringIndex = 7;
			break;
		case tmfoErr:
			stringIndex = 8;
			break;
		case wPrErr:
			stringIndex = 9;
			break;
		case fLckdErr:
			stringIndex = 10;
			break;
		case vLckdErr:
			stringIndex = 11;
			break;
		case fBsyErr:
			stringIndex = 12;
			break;
		case dupFNErr:
			stringIndex = 13;
			break;
		case opWrErr:
			stringIndex = 14;
			break;
		case volOffLinErr:
			stringIndex = 15;
			break;
		case permErr:
			stringIndex = 16;
			break;
		case wrPermErr:
			stringIndex = 17;
			break;
		default:
			stringIndex = 1;
			break;
	}
	InitCursor();
	
	GetIndString(errMessage, rFileErrorStrings, stringIndex);
	NumToString((long)resultCode, errNumString);
	ParamText(errMessage, errNumString, fileName, "\p");
	
	CenterAlert(rFileErrorAlert);
	dummyInt = Alert(rFileErrorAlert, 0L);
	
	return(FALSE);
}


