diff --git a/core/systems/ExtensionSys.cpp b/core/systems/ExtensionSys.cpp index bf30cec3..7ff728c6 100644 --- a/core/systems/ExtensionSys.cpp +++ b/core/systems/ExtensionSys.cpp @@ -124,11 +124,13 @@ bool CExtension::Load(char *error, size_t maxlength) CExtension::~CExtension() { + char temp_buffer[255]; + if (m_pAPI) { if (m_PlId) { - g_pMMPlugins->Unload(m_PlId, true, NULL, 0); + g_pMMPlugins->Unload(m_PlId, true, temp_buffer, sizeof(temp_buffer)); } } @@ -435,14 +437,16 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file) return FindExtensionByFile(path); } - /* Make sure the file direction is right */ - char path[PLATFORM_MAX_PATH]; - g_LibSys.PathFormat(path, sizeof(path), "%s", file); + /* Chomp off the path */ + char lookup[PLATFORM_MAX_PATH]; + g_LibSys.GetFileFromPath(lookup, sizeof(lookup), file); for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++) { pExt = (*iter); - if (strcmp(pExt->GetFilename(), path) == 0) + char short_file[PLATFORM_MAX_PATH]; + g_LibSys.GetFileFromPath(short_file, sizeof(short_file), pExt->GetFilename()); + if (strcmp(lookup, short_file) == 0) { return pExt; } diff --git a/core/systems/LibrarySys.cpp b/core/systems/LibrarySys.cpp index f4cc8e07..373fe223 100644 --- a/core/systems/LibrarySys.cpp +++ b/core/systems/LibrarySys.cpp @@ -381,7 +381,7 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char for (size_t i = length - 1; i >= 0 && i <= length - 1; - i++) + i--) { if (path[i] == '/' #if defined PLATFORM_WINDOWS