From 20cb9625eac890dae2ece43d6181e34354f0fd52 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 5 Jan 2009 17:35:26 +0000 Subject: [PATCH] From Jason Beverage, "I thought about the issue I was having with the CURL plugin automatically trying to download all filenames with URL's rather than passing the full URL to the plugin. It turns out the solution was pretty simple. I've made a small change to Registry.cpp that puts the CURL logic AFTER the URL has been passed to the plugin rather than assuming all URL's need to be downloaded by the CURL plugin. This way, plugins can have first crack at the URL's, and if they don't handle it the previous CURL behavior kicks in." --- src/osgDB/Registry.cpp | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index c12fef902..ace55bd57 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1472,26 +1472,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) return archive->readObject(fileName,options.get()); } } - - // if filename contains archive - // then get archive name - // if archive name is not in the cache then do an openArchive on - // that archive name - // use that archive to read the file. - - if (containsServerAddress(readFunctor._filename)) - { - ReaderWriter* rw = getReaderWriterForExtension("curl"); - if (rw) - { - return readFunctor.doRead(*rw); - } - else - { - return ReaderWriter::ReadResult("Warning: Could not find the .curl plugin to read from server."); - } - } - + // record the errors reported by readerwriters. typedef std::vector Results; Results results; @@ -1556,6 +1537,21 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) else results.push_back(rr); } } + + //If the filename contains a server address and wasn't loaded by any of the plugins, try to use the CURL plugin + //to download the file and use the stream reading functionality of the plugins to load the file + if (containsServerAddress(readFunctor._filename)) + { + ReaderWriter* rw = getReaderWriterForExtension("curl"); + if (rw) + { + return readFunctor.doRead(*rw); + } + else + { + return ReaderWriter::ReadResult("Warning: Could not find the .curl plugin to read from server."); + } + } if (!results.empty()) {