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

Jeremy jswigart at gmail.com
Fri Dec 11 03:33:46 PST 2015

That's fine, I will probably do that, but is it not reasonable for the
default to be able to handle network paths and construct working cache
paths as well?

On Fri, Dec 11, 2015, 2:10 AM Robert Osfield <robert.osfield at gmail.com>

> Hi Jeremy,
> The FileCache::isFileAppropriateForFileCache(..) method is virtual so you
> can subclass from FileCache override this method and than construct your
> own FIleCache and attach it to the osgDB::Registry by doing:
>    osgDB::Registry::instance()->setFileCache(new MyFileCache);
> Robert.
> On 11 December 2015 at 02:10, Jeremy <jswigart at gmail.com> wrote:
>> 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?
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151211/81516034/attachment-0003.htm>

More information about the osg-users mailing list