Load testing

A 3D model needs to test for the file extension for the bitmapFileMaterial it should be using. Could be…

example.png, example.jpg or example.gif

One of the files does exists and should get used. It doesn’t know which it should go for at the moment. Can I do a testing function like:

if (bitmapFileMaterial exists = png) {
load bitmapFileMaterial example.png
} else if (bitmapFileMaterial png = NULL) {
load bitmapFileMaterial example.jpg
}

Really need some help here! Thanks