-
Notifications
You must be signed in to change notification settings - Fork 81
Folder structure and RTTR_*DIR config variables
We want to support the following use cases for running RTTR:
- Run from extracted archive downloaded from the website
- Run from installed location via CMake (possibly modified by
DESTDIR
) - Run from build directory (for testing/debugging)
- Run from installed package (especially linux)
- Allow moving around the installation dir (especially for windows, LAN parties etc)
For this a certain folder structure is used.
CMake defines some variables (except for windows) which are then transferred as defines to the program. These are with usual defaults in parantheses:
-
RTTR_BINDIR
(bin): executables -
RTTR_DATADIR
(share/s25rttr): data for RTTR (language files, maps, resources) -
RTTR_GAMEDIR
(RTTR_DATADIR/S2): original game files (DATA, GFX folders) -
RTTR_LIBDIR
(lib): shared binaries -
RTTR_DRIVERDIR
(RTTR_LIBDIR/driver): audio/video driver libs -
RTTR_DOCDIR
(doc): documentation files
On windows most of them are basically "." so they are all in the same folder.
All of them are relative to a path prefix which is usually the installation directory (e.g. CMAKE_INSTALL_PREFIX
possibly with DESTDIR
prefixed itself). As it is always possible to find the full path to the executable being run we can remove RTTR_BINDIR
from that to get this prefix path.
Optionally it is possible to overwrite this prefix path by setting the environment variable RTTR_PREFIX_DIR
before starting the program.
Having found (or set) the prefix path, the program treats all directories (RTTR_*DIR
) relative to that.
Note that the prefix path on linux is usually /
or /usr
.
There are examples (especially involving symlinks) where the detection of the prefix path may fail. In this case one can set the environment variable manually.
Note that no absolute paths are used as our main goal is to provide archives for easy installation and use. Using absolute path would make it impossible to e.g. move rttr to from /bin
etc. to /usr/bin
etc.