From 5ceb4730adb21f074aa91e70881fdefb1841b524 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 1 Jun 2021 17:11:13 +0000 Subject: [PATCH] COM_FileBase should strip .ext.gz instead of leaving the .ext there - the .gz is handled by our filesystem so we try to pretend that its not there. This fixes loading textures/foo/bar.png files from inside foo.bsp.gz files. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5882 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/common.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engine/common/common.c b/engine/common/common.c index ea9b2fb6e..49806129c 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -2431,7 +2431,12 @@ void QDECL COM_StripExtension (const char *in, char *out, int outlen) if (*s == '.') { *s = 0; - break; + + //some extensions don't really count, strip the next one too... + if (!strcmp(s+1,"gz")) + ; + else + break; } s--; @@ -2568,8 +2573,12 @@ void COM_FileBase (const char *in, char *out, int outlen) s = in + strlen(in) - 1; - while (s > in && *s != '.' && *s != '/') + while (s > in) + { + if ((*s == '.'&&strcmp(s+1,"gz")) || *s == '/') + break; s--; + } for (s2 = s ; s2 > in && *s2 && *s2 != '/' ; s2--) ;