ISource2ModPaths
Where Source2Mod keeps things on disk.
Every path a plugin needs comes from here rather than being spelled out against the game directory, so the layout can move without every plugin having to be found and edited.
Source2Mod's on-disk layout.
Under the game directory:
addons/source2mod/
configs/ core.json, and one directory per plugin
<PluginName>/ this plugin's own configs
gamedata/ every .json here is read into the game config
plugins/ the .smx files themselves
shared/ data more than one plugin readsThe returned strings are owned by Source2Mod and stay valid for as long as it is loaded; copy them if you need to keep one past that.
Interface id ISource2ModPaths001 (SOURCE2MOD_PATHS_INTERFACE) · Global g_pSource2ModPaths · Header source2mod/ISource2ModPaths.h
Methods
GameDirectory
virtual const char* GameDirectory() = 0;The game directory, e.g. ".../game/csgo".
RootDirectory
virtual const char* RootDirectory() = 0;addons/source2mod.
ConfigsDirectory
virtual const char* ConfigsDirectory() = 0;addons/source2mod/configs.
GamedataDirectory
virtual const char* GamedataDirectory() = 0;addons/source2mod/gamedata.
PluginsDirectory
virtual const char* PluginsDirectory() = 0;addons/source2mod/plugins, where the .smx files live.
SharedDirectory
virtual const char* SharedDirectory() = 0;addons/source2mod/shared, for data more than one plugin reads.
PluginConfigDirectory
virtual const char* PluginConfigDirectory(PluginId owner) = 0;This plugin's own config directory, configs/<PluginName>.
The directory is not created for you; it is where the plugin's files are expected to have been installed.
| Parameter | Type | Description |
|---|---|---|
owner | PluginId | Plugin ID to look up |
Returns const char* — The path, or nullptr when there is no such plugin
Macros
PLUGIN_CONFIG_DIR
#define PLUGIN_CONFIG_DIR() g_pSource2ModPaths->PluginConfigDirectory(g_PluginID)This plugin's config directory; the plugin ID is filled in for you.
Other macros
| Macro | Expands to |
|---|---|
SOURCE2MOD_GAME_DIR() | g_pSource2ModPaths->GameDirectory() |
SOURCE2MOD_ROOT_DIR() | g_pSource2ModPaths->RootDirectory() |
SOURCE2MOD_CONFIGS_DIR() | g_pSource2ModPaths->ConfigsDirectory() |
SOURCE2MOD_GAMEDATA_DIR() | g_pSource2ModPaths->GamedataDirectory() |
SOURCE2MOD_PLUGINS_DIR() | g_pSource2ModPaths->PluginsDirectory() |
SOURCE2MOD_SHARED_DIR() | g_pSource2ModPaths->SharedDirectory() |