From 9b6e10ddf0fede8ea13e06d6b824450915aff153 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 9 Feb 2012 17:52:13 +0000 Subject: [PATCH] From Torben Dannhauer, "Modification to osgfilecache: Now source data can also be local.: find attached my modifications to osgfilecache. It now allows also the caching of LOCAL terrain databases. In combination with the extends and level cmd parameter it allows to extract parts of terrain databases and write it in a new "Sub database". I also modified osgDB::FileCache to create correct filenames if the data source is local." --- applications/osgfilecache/osgfilecache.cpp | 2 +- src/osgDB/FileCache.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/osgfilecache/osgfilecache.cpp b/applications/osgfilecache/osgfilecache.cpp index 95e151bea..8b6d56c5b 100644 --- a/applications/osgfilecache/osgfilecache.cpp +++ b/applications/osgfilecache/osgfilecache.cpp @@ -309,7 +309,7 @@ public: osg::Node* readNodeFileAndWriteToCache(const std::string& filename) { osg::Node* node = 0; - if (_fileCache.valid() && osgDB::containsServerAddress(filename)) + if (_fileCache.valid() ) { if (_fileCache->existsInCache(filename)) { diff --git a/src/osgDB/FileCache.cpp b/src/osgDB/FileCache.cpp index 63aa745dc..175dabc85 100644 --- a/src/osgDB/FileCache.cpp +++ b/src/osgDB/FileCache.cpp @@ -42,8 +42,9 @@ bool FileCache::isFileAppropriateForFileCache(const std::string& originalFileNam std::string FileCache::createCacheFileName(const std::string& originalFileName) const { + std::string serverAddress = osgDB::getServerAddress(originalFileName); std::string cacheFileName = _fileCachePath + "/" + - osgDB::getServerAddress(originalFileName) + "/" + + serverAddress + (serverAddress.empty()?"":"/") + osgDB::getServerFileName(originalFileName); OSG_INFO<<"FileCache::createCacheFileName("<