open 'foo.fmf' in preference to 'default.fmf' when running eg foo_x86.exe. This should make TCs a little easier to release/maintain within eg quake's basedir, without breaking other TCs mods in the same basedir.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5352 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-12-04 06:15:53 +00:00
parent 8128d275af
commit c3b97f0983

View file

@ -5293,10 +5293,22 @@ ftemanifest_t *FS_ReadDefaultManifest(char *newbasedir, size_t newbasedirsize, q
//hopefully this will be used for TCs. //hopefully this will be used for TCs.
if (!man && game == -1) if (!man && game == -1)
{ {
char exename[MAX_QPATH];
COM_StripAllExtensions(COM_SkipPath(com_argv[0]), exename, sizeof(exename));
//take away any amd64/x86/x86_64 postfix, so that people can have multiple cpu arch binaries sharing a single fmf
if (strlen(exename) > strlen(ARCH_CPU_POSTFIX) && !strcmp(exename+strlen(exename)-strlen(ARCH_CPU_POSTFIX), ARCH_CPU_POSTFIX))
exename[strlen(exename)-strlen(ARCH_CPU_POSTFIX)] = 0;
//and then the trailing _ (before said postfix)
if (exename[strlen(exename)] == '_')
exename[strlen(exename)] = 0;
//and hopefully we now have something consistent that we can try to use.
f = VFSOS_Open(va("%s%s.fmf", newbasedir, exename), "rb");
#ifdef BRANDING_NAME #ifdef BRANDING_NAME
f = VFSOS_Open(va("%s"STRINGIFY(BRANDING_NAME)".fmf", newbasedir), "rb");
if (!f) if (!f)
f = VFSOS_Open(va("%s"STRINGIFY(BRANDING_NAME)".fmf", newbasedir), "rb");
#endif #endif
if (!f)
f = VFSOS_Open(va("%sdefault.fmf", newbasedir), "rb"); f = VFSOS_Open(va("%sdefault.fmf", newbasedir), "rb");
if (f) if (f)
{ {