Wow, how did this go unnoticed:

Fixed ILibrarySys::GetFileExtension() and loading plugins without the "smx" extension.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40835
This commit is contained in:
Scott Ehlert 2007-05-22 03:39:18 +00:00
parent a322067b83
commit a5e3c79402

View File

@ -325,16 +325,21 @@ size_t LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
const char *LibrarySystem::GetFileExtension(const char *filename) const char *LibrarySystem::GetFileExtension(const char *filename)
{ {
size_t len = strlen(filename); size_t end = strlen(filename) - 1;
for (size_t i = len - 1; i >= 0; i--) for (size_t i = end; i >= 0; i--)
{ {
if (filename[i] == PLATFORM_SEP_CHAR || filename[i] == PLATFORM_SEP_ALTCHAR) if (i > end)
{ {
return NULL; break;
} }
if (filename[i] == '.' && i != len - 1) if (filename[i] == PLATFORM_SEP_CHAR || filename[i] == PLATFORM_SEP_ALTCHAR)
{
break;
}
if (filename[i] == '.' && i != end)
{ {
return &filename[++i]; return &filename[++i];
} }