From c66557087dfd615495f9e4ee5db2207abb1e7c9e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 8 Oct 2001 08:35:06 +0000 Subject: [PATCH] Added support for using osgDB::fineFile into the .flt plugin. --- src/osgPlugins/flt/FltFile.cpp | 11 ++++++++++- src/osgPlugins/flt/Input.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/flt/FltFile.cpp b/src/osgPlugins/flt/FltFile.cpp index fe755f661..5a1271819 100644 --- a/src/osgPlugins/flt/FltFile.cpp +++ b/src/osgPlugins/flt/FltFile.cpp @@ -4,6 +4,8 @@ #include #include +#include + #include "FltFile.h" #include "Registry.h" #include "Record.h" @@ -86,7 +88,14 @@ Record* FltFile::readFile(const std::string& fileName) { FileInput fin; - if (!fin.open(fileName)) return NULL; + if (!fin.open(fileName)) + { + // ok havn't found file, resort to using findFile... + std::string newFileName = osgDB::findFile(fileName.c_str()); + + if (newFileName.empty()) return NULL; + if (!fin.open(newFileName)) return NULL; + } osg::notify(osg::INFO) << "Loading " << fileName << " ... " << endl; diff --git a/src/osgPlugins/flt/Input.cpp b/src/osgPlugins/flt/Input.cpp index 80c10a71c..0a2ab5b36 100644 --- a/src/osgPlugins/flt/Input.cpp +++ b/src/osgPlugins/flt/Input.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "Input.h" #include "Record.h" @@ -63,7 +64,15 @@ bool FileInput::eof() bool FileInput::open(const std::string& fileName) { _file=::fopen( fileName.c_str(), "rb"); - if (_file == NULL) return false; + if (_file == NULL) + { + // ok havn't found file, resort to using findFile... + std::string newFileName = osgDB::findFile(fileName.c_str()); + if (newFileName.empty()) return false; + + _file=::fopen( fileName.c_str(), "rb"); + if (_file == NULL) return false; + } _eof = false; return true; }