diff --git a/src/osgPlugins/curl/ReaderWriterCURL.cpp b/src/osgPlugins/curl/ReaderWriterCURL.cpp index 731fdd56e..60f2205fe 100644 --- a/src/osgPlugins/curl/ReaderWriterCURL.cpp +++ b/src/osgPlugins/curl/ReaderWriterCURL.cpp @@ -10,6 +10,7 @@ */ +#include #include #include #include @@ -144,6 +145,22 @@ class ReaderWriterCURL : public osgDB::ReaderWriter osg::notify(osg::NOTICE)<<"Error: No ReaderWriter for file "<readObject(cacheFileName,options); + } std::stringstream buffer; @@ -157,16 +174,47 @@ class ReaderWriterCURL : public osgDB::ReaderWriter if (res==0) { + + osg::ref_ptr local_opt = const_cast(options); if (!local_opt) local_opt = new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); - ReadResult result = readFile(objectType, reader, buffer, local_opt.get() ); + ReadResult readResult = readFile(objectType, reader, buffer, local_opt.get() ); local_opt->getDatabasePathList().pop_front(); - - return result; + + if (fileCachePath && readResult.validObject()) + { + osg::notify(osg::NOTICE)<<"Writing cache file "<