core/sourcemod.cpp
changeset 696 d5cc8d0fa899
parent 688 0b99367c7a5a
child 718 8a5d1da7dd18
     1.1 --- a/core/sourcemod.cpp	Sat Apr 14 04:19:58 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Sat Apr 14 04:27:47 2007 +0000
     1.3 @@ -100,7 +100,21 @@
     1.4  
     1.5  bool SourceModBase::InitializeSourceMod(char *error, size_t err_max, bool late)
     1.6  {
     1.7 -	g_BaseDir.assign(g_SMAPI->GetBaseDir());
     1.8 +	const char *gamepath = g_SMAPI->GetBaseDir();
     1.9 +
    1.10 +	/* Store full path to game */
    1.11 +	g_BaseDir.assign(gamepath);
    1.12 +
    1.13 +	/* Store name of game directory by itself */
    1.14 +	size_t len = strlen(gamepath);
    1.15 +	for (size_t i = len - 1; i >= 0; i--)
    1.16 +	{
    1.17 +		if (gamepath[i] == PLATFORM_SEP_CHAR)
    1.18 +		{
    1.19 +			strncopy(m_ModDir, &gamepath[++i], sizeof(m_ModDir));
    1.20 +			break;
    1.21 +		}
    1.22 +	}
    1.23  
    1.24  	/* Initialize CoreConfig so we can get SourceMod base path properly - this basically parses core.cfg */
    1.25  	g_CoreConfig.Initialize();
    1.26 @@ -528,6 +542,11 @@
    1.27  	return 0;
    1.28  }
    1.29  
    1.30 +const char *SourceModBase::GetModFolderName() const
    1.31 +{
    1.32 +	return m_ModDir;
    1.33 +}
    1.34 +
    1.35  SMGlobalClass *SMGlobalClass::head = NULL;
    1.36  
    1.37  SMGlobalClass::SMGlobalClass()