mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-15 04:29:37 +00:00
Lots of stuff
This commit is contained in:
101
GpApp/FileError.cpp
Normal file
101
GpApp/FileError.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
//============================================================================
|
||||
//----------------------------------------------------------------------------
|
||||
// FileError.c
|
||||
//----------------------------------------------------------------------------
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
|
||||
|
||||
#define rFileErrorAlert 140
|
||||
#define rFileErrorStrings 140
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
//-------------------------------------------------------------- CheckFileError
|
||||
|
||||
// Given a result code (returned from a previous file operation) this<69>
|
||||
// function cheks to see if the result code is an error and, if it is<69>
|
||||
// a common error for which I have a string message, I bring up an<61>
|
||||
// alert with the error message. If it is an unusual error, I still<6C>
|
||||
// bring up an alert but with "Miscellaneous file error" and the<68>
|
||||
// error ID.
|
||||
|
||||
Boolean CheckFileError (short resultCode, const PLPasStr &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, PSTR(""));
|
||||
|
||||
// CenterAlert(rFileErrorAlert);
|
||||
dummyInt = Alert(rFileErrorAlert, 0L);
|
||||
|
||||
return(false);
|
||||
}
|
||||
Reference in New Issue
Block a user