[osg-users] osgDB::FileCache for network sources

Jeremy jswigart at gmail.com
Thu Dec 10 18:10:52 PST 2015


I have a large data set that is on a network that my application pulls
small sections of. I want to use the file cache to build local caches of
only the content the application needs without needing to clone the entire
tree.

When i register a file cache with my prototype application(which is
currently just a slightly hacked osgViewer). I then proceed to load up my
content using the network mapped paths(on windows, this amounts to a bunch
of calls to \\somecomputer\somepath\whatever.flt for the terrain tiles, and
then that in turn will pull in external references etc.

The problem I'm having is that the file cache doesn't cache all these files
like I would prefer it to. After a bit of debugging,
the FileCache::isFileAppropriateForFileCache returns false because the url
isn't prefixed with the known protocols(ftp, http, etc). As a quick
workaround I made this function return true always to see if it would
cache, and the next place that failed was when it tried to write out the
cached file, since a network URL sent through createCacheFileName doesn't
produce a valid file path.

This is probably something I can get working with local modifications but I
would like to ask that the developers consider some additional FileCache
options so that one can tell it to cache all files, and not just the ones
it deems to be "appropriate", which appears to be limited to remote url
paths.The standalone osgfilecache application I think has the right idea
with caching everything, but I'm wanted to avoid the need to run a
preprocessing step. It appears as well that even if I created and populated
the cache myself externally, the case(HANDLE_NON_HTTP): in the pager still
only checks the cache given the success of
the isFileAppropriateForFileCache.

Perhaps it's also reasonable for this check to identify network URLs as
viable candidates too?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151211/73ae4133/attachment-0002.htm>


More information about the osg-users mailing list