From 689eca77d771ad7d009f3b5bdf8ac0d02a1dc7e0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 4 Mar 2002 01:37:18 +0000 Subject: [PATCH] Added file extension guard to .obj reader plugin. --- src/osgPlugins/obj/ReaderWriterOBJ.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/obj/ReaderWriterOBJ.cpp b/src/osgPlugins/obj/ReaderWriterOBJ.cpp index fabf38c42..b51ec9295 100644 --- a/src/osgPlugins/obj/ReaderWriterOBJ.cpp +++ b/src/osgPlugins/obj/ReaderWriterOBJ.cpp @@ -45,7 +45,7 @@ public: virtual const char* className() { return "Wavefront OBJ Reader"; } virtual bool acceptsExtension(const std::string& extension) { - return (extension == "obj"); + return osgDB::equalCaseInsensitive(extension,"obj"); } virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*); @@ -62,6 +62,10 @@ osgDB::RegisterReaderWriterProxy g_objReaderWriterProxy; // read file and convert to OSG. osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) { + std::string ext = osgDB::getFileExtension(fileName); + if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; + + GLMmodel* obj = glmReadOBJ((char*) fileName.c_str()); if (!obj) return ReadResult::FILE_NOT_HANDLED;