UTIL GetModDir

From Valve Developer Community
Revision as of 22:54, 22 July 2021 by Amicdict (talk | contribs) (Created page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A UTIL function that retrieves the mod (or game) directory name for the active game (ie. "hl2", "csgo", or "tf"), by storing the game directory path in lpszTextOut and then culls the entire directory path, leaving only the directory name. This function returns false if the length of the game directory path is longer than nSize, otherwise it will return true.


bool UTIL_GetModDir(char *lpszTextOut, unsigned int nSize)


Get mod directory and store it.

char pGameDir[1024];
UTIL_GetModDir(pGameDir, 1024);