core/metamod.cpp
changeset 626 08879e2aa990
parent 603 f5602d4a89d6
child 635 61c2224c8d68
     1.1 --- a/core/metamod.cpp	Sun Dec 07 23:50:23 2008 -0600
     1.2 +++ b/core/metamod.cpp	Mon Dec 22 22:55:55 2008 -0600
     1.3 @@ -1114,7 +1114,7 @@
     1.4  {
     1.5  	PluginId id;
     1.6  	bool already;
     1.7 -	char alias[24], file[255], error[255];
     1.8 +	char alias[24], file[255], full_path[255], error[255];
     1.9  
    1.10  	if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias)))
    1.11  	{
    1.12 @@ -1125,7 +1125,31 @@
    1.13  	if (alias[0] != '\0')
    1.14  		g_PluginMngr.SetAlias(alias, file);
    1.15  
    1.16 -	id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
    1.17 +	/* Attempt to find a file extension */
    1.18 +	if (UTIL_GetExtension(file) == NULL)
    1.19 +	{
    1.20 +		g_pMetamod->PathFormat(full_path, 
    1.21 +			sizeof(full_path), 
    1.22 +			"%s/%s%s", 
    1.23 +			g_pMetamod->GetBaseDir(), 
    1.24 +			file, 
    1.25 +#if defined WIN32 || defined _WIN32
    1.26 +			".dll"
    1.27 +#else
    1.28 +			"_i486.so"
    1.29 +#endif
    1.30 +			);
    1.31 +	}
    1.32 +	else
    1.33 +	{
    1.34 +		g_pMetamod->PathFormat(full_path,
    1.35 +			sizeof(full_path),
    1.36 +			"%s/%s", 
    1.37 +			g_pMetamod->GetBaseDir(),
    1.38 +			file);
    1.39 +	}
    1.40 +
    1.41 +	id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
    1.42  	skipped = already;
    1.43  	if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
    1.44  	{