Add DEFAULT_RELATIVE_BASEDIR

Sys_BinaryPathRelative takes a parameter which is path concatenated with
Sys_BinaryPath, and resolved to a canonical path. The intended use case
is to facilitate the situation where you want the game data directory to
exist outside the same directory in which the binary lives, but relative
to it. More specifically, if you want to distriute multiple binaries for
different architectures, in the same tree, this allows for a means of
having said binaries in architecture subdirectories, with a shared data
directory, e.g.:

  ioq3/x86/ioquake3.exe etc.
  ioq3/x86_64/ioquake3.exe etc.
  ioq3/baseq3/pak0.pk3 etc.

Here, when building you would define DEFAULT_RELATIVE_BASEDIR=".." by
appending it to the build system CFLAGS, and then the executables will
by default look in their parent directory for the data.
This commit is contained in:
Tim Angus committed 2025-08-23 21:01:08 +01:00
1 parent 9293a45368
commit d133be28eb
4 files changed
+44 -1

No files matched your search

+3 -1
View File
@@ -721,7 +721,9 @@ char *Sys_ParseProtocolUri( const char *uri )
#endif
#ifndef DEFAULT_BASEDIR
# ifdef __APPLE__
# if defined(DEFAULT_RELATIVE_BASEDIR)
# define DEFAULT_BASEDIR Sys_BinaryPathRelative(DEFAULT_RELATIVE_BASEDIR)
# elif defined(__APPLE__)
# define DEFAULT_BASEDIR Sys_StripAppBundle(Sys_BinaryPath())
# else
# define DEFAULT_BASEDIR Sys_BinaryPath()