summaryrefslogtreecommitdiff
path: root/progs/util
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-13 16:16:00 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-03-16 12:01:44 +0000
commite5a3aa5672af11f69daa67182123cdf353eecbde (patch)
treeaa7650be994acff804b2d72f28693e8a0a4612a3 /progs/util
parented7bb2c196cbe9df8d56ab409da459a9dc4894b4 (diff)
progs: Try to read the texture from the current dir, if full path fails.
Diffstat (limited to 'progs/util')
-rw-r--r--progs/util/readtex.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index 37d5fcd0d3..8e923b6eb4 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -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);