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();
|
return m_RealFile.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *CExtension::GetPath() const
|
||||||
|
{
|
||||||
|
return m_Path.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
IdentityToken_t *CExtension::GetIdentity()
|
IdentityToken_t *CExtension::GetIdentity()
|
||||||
{
|
{
|
||||||
return m_pIdentToken;
|
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. */
|
/* Remove platform extension if it's there. Compat hack. */
|
||||||
const char *ext = g_LibSys.GetFileExtension(path);
|
const char *ext = g_LibSys.GetFileExtension(path);
|
||||||
@ -589,7 +594,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
|||||||
char path2[PLATFORM_MAX_PATH];
|
char path2[PLATFORM_MAX_PATH];
|
||||||
UTIL_Format(path2, sizeof(path2), "%s", path);
|
UTIL_Format(path2, sizeof(path2), "%s", path);
|
||||||
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||||
return LoadAutoExtension(path2);
|
return LoadAutoExtension(path2, bErrorOnMissing);
|
||||||
}
|
}
|
||||||
|
|
||||||
IExtension *pAlready;
|
IExtension *pAlready;
|
||||||
@ -607,8 +612,12 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
|||||||
m_Libs.push_back(p);
|
m_Libs.push_back(p);
|
||||||
|
|
||||||
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
|
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
|
||||||
|
{
|
||||||
|
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
|
||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||||
|
}
|
||||||
|
|
||||||
p->SetError(error);
|
p->SetError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ public:
|
|||||||
public: //IExtension
|
public: //IExtension
|
||||||
IExtensionInterface *GetAPI();
|
IExtensionInterface *GetAPI();
|
||||||
const char *GetFilename();
|
const char *GetFilename();
|
||||||
|
const char *GetPath() const;
|
||||||
IdentityToken_t *GetIdentity();
|
IdentityToken_t *GetIdentity();
|
||||||
ITERATOR *FindFirstDependency(IExtension **pOwner, SMInterface **pInterface);
|
ITERATOR *FindFirstDependency(IExtension **pOwner, SMInterface **pInterface);
|
||||||
bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface);
|
bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface);
|
||||||
@ -163,7 +164,7 @@ public: //IPluginsListener
|
|||||||
public: //IRootConsoleCommand
|
public: //IRootConsoleCommand
|
||||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||||
public:
|
public:
|
||||||
IExtension *LoadAutoExtension(const char *path);
|
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
|
||||||
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
||||||
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
||||||
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
|
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
|
||||||
|
@ -1308,7 +1308,8 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
|
|||||||
if (ext->autoload)
|
if (ext->autoload)
|
||||||
{
|
{
|
||||||
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
|
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)
|
else if (pass == 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user