Difference between revisions of "UTIL GetModDir"

From Valve Developer Community
Jump to: navigation, search
(Created page.)
 
m (Cleanup)
 
Line 2: Line 2:
  
 
==Usage==
 
==Usage==
bool UTIL_GetModDir(char *lpszTextOut, unsigned int nSize)
+
<source lang=cpp>
 +
bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize )
 +
</source>
  
 
==Example==
 
==Example==
 
Get mod directory and store it.
 
Get mod directory and store it.
char pGameDir[1024];
+
<source lang=cpp>
UTIL_GetModDir(pGameDir, 1024);
+
    char pGameDir[1024];
 +
    UTIL_GetModDir( pGameDir, 1024 );
 +
</source>
  
 
[[Category:UTIL]]
 
[[Category:UTIL]]

Latest revision as of 13:19, 29 July 2021

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.

Usage

bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize )

Example

Get mod directory and store it.

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