From da650606e36df06ad96438f0797252d0aa07be3a Mon Sep 17 00:00:00 2001 From: systematicmania Date: Sat, 24 Aug 2013 00:12:21 -0400 Subject: [PATCH] Fixed optional dependencies logging errors (again) (bug 5739, r=dvander). Regression from changeset 4c93f74cae51 and changeset 7dae5b0b8e28 in bug 5860. --- core/logic/ExtensionSys.cpp | 10 +++++++--- core/logic/ExtensionSys.h | 2 +- core/logic/PluginSys.cpp | 2 +- core/logic/intercom.h | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/logic/ExtensionSys.cpp b/core/logic/ExtensionSys.cpp index 87fe1c44..988b7c92 100644 --- a/core/logic/ExtensionSys.cpp +++ b/core/logic/ExtensionSys.cpp @@ -577,7 +577,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 = libsys->GetFileExtension(path); @@ -586,7 +586,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path) char path2[PLATFORM_MAX_PATH]; smcore.Format(path2, sizeof(path2), "%s", path); path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0'; - return LoadAutoExtension(path2); + return LoadAutoExtension(path2, bErrorOnMissing); } IExtension *pAlready; @@ -605,7 +605,11 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path) if (!p->Load(error, sizeof(error)) || !p->IsLoaded()) { - smcore.LogError("[SM] Unable to load extension \"%s\": %s", path, error); + if (bErrorOnMissing || libsys->IsPathFile(p->GetPath())) + { + smcore.LogError("[SM] Unable to load extension \"%s\": %s", path, error); + } + p->SetError(error); } diff --git a/core/logic/ExtensionSys.h b/core/logic/ExtensionSys.h index 25a195ad..151d7327 100644 --- a/core/logic/ExtensionSys.h +++ b/core/logic/ExtensionSys.h @@ -164,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, SMPlugin *pPlugin); diff --git a/core/logic/PluginSys.cpp b/core/logic/PluginSys.cpp index cc14a1e8..fd67f51a 100644 --- a/core/logic/PluginSys.cpp +++ b/core/logic/PluginSys.cpp @@ -1286,7 +1286,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass { libsys->PathFormat(path, PLATFORM_MAX_PATH, "%s", file); bool bErrorOnMissing = ext->required ? true : false; - g_Extensions.LoadAutoExtension(path); + g_Extensions.LoadAutoExtension(path, bErrorOnMissing); } } else if (pass == 2) diff --git a/core/logic/intercom.h b/core/logic/intercom.h index 006ea9e3..c829e108 100644 --- a/core/logic/intercom.h +++ b/core/logic/intercom.h @@ -49,7 +49,7 @@ using namespace SourceHook; * Add 1 to the RHS of this expression to bump the intercom file * This is to prevent mismatching core/logic binaries */ -#define SM_LOGIC_MAGIC (0x0F47C0DE - 23) +#define SM_LOGIC_MAGIC (0x0F47C0DE - 24) #if defined SM_LOGIC class IVEngineServer @@ -164,7 +164,7 @@ public: class IExtensionSys : public IExtensionManager { public: - virtual IExtension *LoadAutoExtension(const char *name) = 0; + virtual IExtension *LoadAutoExtension(const char *name, bool bErrorOnMissing=true) = 0; virtual void TryAutoload() = 0; virtual void Shutdown() = 0; virtual IExtension *FindExtensionByFile(const char *name) = 0;