core/ExtensionSys.cpp
changeset 3402 a459183ce707
parent 3373 c6463cdc2180
child 3511 c9fd86b6bec3
     1.1 --- a/core/ExtensionSys.cpp	Tue Oct 11 22:50:21 2011 -0400
     1.2 +++ b/core/ExtensionSys.cpp	Tue Oct 11 22:51:24 2011 -0400
     1.3 @@ -372,6 +372,11 @@
     1.4  	return m_RealFile.c_str();
     1.5  }
     1.6  
     1.7 +const char *CExtension::GetPath() const
     1.8 +{
     1.9 +	return m_Path.c_str();
    1.10 +}
    1.11 +
    1.12  IdentityToken_t *CExtension::GetIdentity()
    1.13  {
    1.14  	return m_pIdentToken;
    1.15 @@ -580,7 +585,7 @@
    1.16  	}
    1.17  }
    1.18  
    1.19 -IExtension *CExtensionManager::LoadAutoExtension(const char *path)
    1.20 +IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
    1.21  {
    1.22  	/* Remove platform extension if it's there. Compat hack. */
    1.23  	const char *ext = g_LibSys.GetFileExtension(path);
    1.24 @@ -589,7 +594,7 @@
    1.25  		char path2[PLATFORM_MAX_PATH];
    1.26  		UTIL_Format(path2, sizeof(path2), "%s", path);
    1.27  		path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
    1.28 -		return LoadAutoExtension(path2);
    1.29 +		return LoadAutoExtension(path2, bErrorOnMissing);
    1.30  	}
    1.31  
    1.32  	IExtension *pAlready;
    1.33 @@ -608,7 +613,11 @@
    1.34  
    1.35  	if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
    1.36  	{
    1.37 -		g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
    1.38 +		if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
    1.39 +		{
    1.40 +			g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
    1.41 +		}
    1.42 +
    1.43  		p->SetError(error);
    1.44  	}
    1.45