Removed error when optional ext dep is missing (bug 5112, r=fyren).
This commit is contained in:
parent
67163e14e6
commit
776889cfbb
@ -372,6 +372,11 @@ const char *CExtension::GetFilename()
|
||||
return m_RealFile.c_str();
|
||||
}
|
||||
|
||||
const char *CExtension::GetPath() const
|
||||
{
|
||||
return m_Path.c_str();
|
||||
}
|
||||
|
||||
IdentityToken_t *CExtension::GetIdentity()
|
||||
{
|
||||
return m_pIdentToken;
|
||||
@ -580,7 +585,7 @@ void CExtensionManager::TryAutoload()
|
||||
}
|
||||
}
|
||||
|
||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
|
||||
{
|
||||
/* Remove platform extension if it's there. Compat hack. */
|
||||
const char *ext = g_LibSys.GetFileExtension(path);
|
||||
@ -589,7 +594,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
char path2[PLATFORM_MAX_PATH];
|
||||
UTIL_Format(path2, sizeof(path2), "%s", path);
|
||||
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||
return LoadAutoExtension(path2);
|
||||
return LoadAutoExtension(path2, bErrorOnMissing);
|
||||
}
|
||||
|
||||
IExtension *pAlready;
|
||||
@ -608,7 +613,11 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
|
||||
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
|
||||
{
|
||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
|
||||
{
|
||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||
}
|
||||
|
||||
p->SetError(error);
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
public: //IExtension
|
||||
IExtensionInterface *GetAPI();
|
||||
const char *GetFilename();
|
||||
const char *GetPath() const;
|
||||
IdentityToken_t *GetIdentity();
|
||||
ITERATOR *FindFirstDependency(IExtension **pOwner, SMInterface **pInterface);
|
||||
bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface);
|
||||
@ -163,7 +164,7 @@ public: //IPluginsListener
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
public:
|
||||
IExtension *LoadAutoExtension(const char *path);
|
||||
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
|
||||
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
||||
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
||||
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
|
||||
|
@ -1308,7 +1308,8 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
|
||||
if (ext->autoload)
|
||||
{
|
||||
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
|
||||
g_Extensions.LoadAutoExtension(path);
|
||||
bool bErrorOnMissing = ext->required ? true : false;
|
||||
g_Extensions.LoadAutoExtension(path, bErrorOnMissing);
|
||||
}
|
||||
}
|
||||
else if (pass == 2)
|
||||
|
Loading…
Reference in New Issue
Block a user