core/CoreConfig.cpp
changeset 2752 e19de59cb8e5
parent 2584 6972eb067f48
child 2784 8903397125e6
     1.1 --- a/core/CoreConfig.cpp	Fri Jul 24 13:17:26 2009 +1200
     1.2 +++ b/core/CoreConfig.cpp	Mon Jul 27 13:22:55 2009 -0700
     1.3 @@ -214,14 +214,28 @@
     1.4  	/* Try to get command line value of core config convar */
     1.5  	const char *corecfg = icvar->GetCommandLineValue("sm_corecfgfile");
     1.6  
     1.7 -	/* If sm_corecfgfile not specified on command line, use default value */
     1.8 -	if (!corecfg)
     1.9 +	/* If sm_corecfgfile is on the command line, use that
    1.10 +	 * If sm_corecfgfile isn't there, check sm_basepath on the command line and build the path off that
    1.11 +	 * If sm_basepath isn't there, just use the default path for the cfg
    1.12 +	 */
    1.13 +	if (corecfg)
    1.14 +	{
    1.15 +		g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
    1.16 +	}
    1.17 +	else
    1.18  	{
    1.19 -		corecfg = sm_corecfgfile.GetDefault();
    1.20 -	}
    1.21 +		const char *basepath = icvar->GetCommandLineValue("sm_basepath");
    1.22  
    1.23 -	/* Format path to config file */
    1.24 -	g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
    1.25 +		/* Format path to config file */
    1.26 +		if (basepath)
    1.27 +		{
    1.28 +			g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s/%s", g_SourceMod.GetGamePath(), basepath, "configs/core.cfg");
    1.29 +		}
    1.30 +		else
    1.31 +		{
    1.32 +			g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), sm_corecfgfile.GetDefault());
    1.33 +		}
    1.34 +	}
    1.35  
    1.36  	/* Reset cached key values */
    1.37  	m_KeyValues.clear();