progs: Try to read the texture from the current dir, if full path fails.

This commit is contained in:
José Fonseca 2009-03-13 16:16:00 +00:00
parent ed7bb2c196
commit e5a3aa5672

View file

@ -102,9 +102,15 @@ static rawImageRec *RawImageOpen(const char *fileName)
fprintf(stderr, "Out of memory!\n");
return NULL;
}
if ((raw->file = fopen(fileName, "rb")) == NULL) {
perror(fileName);
return NULL;
raw->file = fopen(fileName, "rb");
if (raw->file == NULL) {
const char *baseName = strrchr(fileName, '/');
if(baseName)
raw->file = fopen(baseName + 1, "rb");
if(raw->file == NULL) {
perror(fileName);
return NULL;
}
}
fread(raw, 1, 12, raw->file);