From Cory Riddell, "Small edit to ReaderWriterDOT.cpp. It wasn't checking the file extension

and so, if the .dot plugin was loaded, it would happily handle any file
name extension.

To reproduce the bug, first save a scene to a dot file (to load the dot
plugin), then try to write the scene to an osg file. If you look at the
osg file, you will see that it is a dot file."
This commit is contained in:
Robert Osfield
2009-11-27 12:17:20 +00:00
parent 980db2c772
commit 5d6ce1a25f

View File

@@ -21,6 +21,11 @@ class ReaderWriterDOT : public osgDB::ReaderWriter {
virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"dot"); }
virtual WriteResult writeNode(const osg::Node& node,const std::string& fileName,const Options* options = NULL) const {
std::string ext = osgDB::getFileExtension(fileName);
if (!acceptsExtension(ext)) {
return WriteResult::FILE_NOT_HANDLED;
}
std::ofstream o( fileName.c_str(), std::ios_base::out );
if ( o ) {
return writeNode( node, o, options );