Write support with .curl pseudo extension added

This commit is contained in:
Konstantin S. Matveyev 2018-03-26 17:59:49 +03:00
parent 80a2dd924f
commit 1a86ed4e7a

View File

@ -424,6 +424,12 @@ osgDB::ReaderWriter::WriteResult ReaderWriterCURL::writeFile(const osg::Object&
// Serialize obj into an std::stringstream buffer which will be uploaded via HTTP post request. // Serialize obj into an std::stringstream buffer which will be uploaded via HTTP post request.
std::string fileName = EasyCurl::getFileNameFromURL(fullFileName); std::string fileName = EasyCurl::getFileNameFromURL(fullFileName);
std::string ext = osgDB::getLowerCaseFileExtension(fileName); std::string ext = osgDB::getLowerCaseFileExtension(fileName);
if (ext == "curl")
{
fileName = osgDB::getNameLessExtension(fileName);
ext = osgDB::getLowerCaseFileExtension(fileName);
}
osgDB::ReaderWriter* writer = osgDB::Registry::instance()->getReaderWriterForExtension(ext); osgDB::ReaderWriter* writer = osgDB::Registry::instance()->getReaderWriterForExtension(ext);
if (!writer) return WriteResult::FILE_NOT_HANDLED; if (!writer) return WriteResult::FILE_NOT_HANDLED;
osgDB::ReaderWriter::WriteResult result = writeFile(obj, writer, requestBuffer, options); osgDB::ReaderWriter::WriteResult result = writeFile(obj, writer, requestBuffer, options);