Fixed optional dependencies logging errors (again) (bug 5739, r=dvander).

Regression from changeset 4c93f74cae51 and changeset 7dae5b0b8e28 in bug 5860.
This commit is contained in:
systematicmania 2013-08-24 00:12:21 -04:00
parent bc789d7c1a
commit da650606e3
4 changed files with 11 additions and 7 deletions

View File

@ -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. */ /* Remove platform extension if it's there. Compat hack. */
const char *ext = libsys->GetFileExtension(path); const char *ext = libsys->GetFileExtension(path);
@ -586,7 +586,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
char path2[PLATFORM_MAX_PATH]; char path2[PLATFORM_MAX_PATH];
smcore.Format(path2, sizeof(path2), "%s", path); smcore.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;
@ -605,7 +605,11 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
if (!p->Load(error, sizeof(error)) || !p->IsLoaded()) 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); p->SetError(error);
} }

View File

@ -164,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, SMPlugin *pPlugin); void BindChildPlugin(IExtension *pParent, SMPlugin *pPlugin);

View File

@ -1286,7 +1286,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
{ {
libsys->PathFormat(path, PLATFORM_MAX_PATH, "%s", file); libsys->PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
bool bErrorOnMissing = ext->required ? true : false; bool bErrorOnMissing = ext->required ? true : false;
g_Extensions.LoadAutoExtension(path); g_Extensions.LoadAutoExtension(path, bErrorOnMissing);
} }
} }
else if (pass == 2) else if (pass == 2)

View File

@ -49,7 +49,7 @@ using namespace SourceHook;
* Add 1 to the RHS of this expression to bump the intercom file * Add 1 to the RHS of this expression to bump the intercom file
* This is to prevent mismatching core/logic binaries * This is to prevent mismatching core/logic binaries
*/ */
#define SM_LOGIC_MAGIC (0x0F47C0DE - 23) #define SM_LOGIC_MAGIC (0x0F47C0DE - 24)
#if defined SM_LOGIC #if defined SM_LOGIC
class IVEngineServer class IVEngineServer
@ -164,7 +164,7 @@ public:
class IExtensionSys : public IExtensionManager class IExtensionSys : public IExtensionManager
{ {
public: public:
virtual IExtension *LoadAutoExtension(const char *name) = 0; virtual IExtension *LoadAutoExtension(const char *name, bool bErrorOnMissing=true) = 0;
virtual void TryAutoload() = 0; virtual void TryAutoload() = 0;
virtual void Shutdown() = 0; virtual void Shutdown() = 0;
virtual IExtension *FindExtensionByFile(const char *name) = 0; virtual IExtension *FindExtensionByFile(const char *name) = 0;