From e17535813fc81ec4ec394e87ec38efeb46f0feaf Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 21 Jan 2009 17:10:51 +0000 Subject: [PATCH] From Jason Beverage, "I realized today that there is an issue with the Registry changes I submitted to allow plugins to have the first go at URLs. The code works fine as is if the format plugin is not already loaded in memory. If a plugin is already in memory, say the PNG plugin for example, then a call to readImageFile("http://server.com/image.png") will return FILE_NOT_FOUND because osgDB::findDataFile will not be able to locate the file. So the Registry::read method is returning before the CURL plugin is given a chance to download the file. I've made a few changes to the Registry to not return FILE_NOT_FOUND if the filename contains a URL that fix the issue." --- src/osgDB/Registry.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 7af9434a4..7c4ba98e6 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1517,12 +1517,16 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) } } - for(ritr=results.begin(); ritr!=results.end(); ++ritr) + //If the filename is a URL, don't return FILE_NOT_FOUND until the CURL plugin is given a chance + if (!osgDB::containsServerAddress(readFunctor._filename)) { - if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) + for(ritr=results.begin(); ritr!=results.end(); ++ritr) { - // osg::notify(osg::NOTICE)<<"Warning: could not find file \""<status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) + { + //osg::notify(osg::NOTICE)<<"Warning: could not find file \""<