char buffer[512];
IUtility->Strlcpy(buffer,"progdir:",512);
IDOS->AddPart(buffer,myimagename,512);
myImage = LoadImage((STRPTR)buffer, AppScreen);
if (!myImage) // could not find images in progdir:
{
IUtility->Strlcpy(buffer,"progdir:images/",512);
IDOS->AddPart(buffer,myimagename,512);
myImage = LoadImage((STRPTR)buffer, AppScreen);
}
if (!myImage) // could not find images in progdir:images
{
IUtility->Strlcpy(buffer,"TBImages:",512);
IDOS->AddPart(buffer,myimagename,512);
myImage = LoadImage((STRPTR)buffer, AppScreen);
}
if (!myImage)
{
// Could not find image file!
// .. handle the error ..
}
// Where LoadImage() is:
struct Image *LoadImage(STRPTR buffer, struct Screen *AppScreen)
{
return BitMapObject,
BITMAP_SourceFile, buffer,
BITMAP_Screen, AppScreen,
BITMAP_Precision, PRECISION_EXACT,
BITMAP_Masking,TRUE,
End;
}
|