[osg-users] Bug in osgDB::findFileInDirectory

Riccardo Corsi riccardo.corsi at kairos3d.it
Tue Mar 27 11:34:52 PDT 2018

Hi Robert,

thanks for the tests.
You're right I was not concatenating the paths correctly,
but the concatenation was ok in the default case,
as the directory path contains a final slash.

Now I've realised THAT is the case when the issue comes up:
if you use a directory path which has the final slash,
findFileInDirectory() fails to find the full path.
Remove the trailing slash and everything works fine.

This happens (at least on OSX) even if you run the example you sent me back
without arguments.

I'm re-attaching your example with the concatenation done the right way as
you suggested.


On Tue, Mar 27, 2018 at 6:38 PM, Robert Osfield <robert.osfield at gmail.com>

> I have just run the test case with a file with the wrong case to see
> what would happen, the results look 100% correct:
> $ ./test --dir ~/OpenSceneGraph/include/osg  --file version
> Result with findFileInDirectory(): 1
> /home/robert/OpenSceneGraph/include/osg/Version
> Result with fileExists(): 0
> concatenated=/home/robert/OpenSceneGraph/include/osgversion
> Result with fileExists(): 0
> proper_fileExsists=/home/robert/OpenSceneGraph/include/osg/version
> This test was run under Linux, so at least on the Linux side things
> are working correctly.  I have to defer to others to test under OSX.
> Robert.
> _______________________________________________
> 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/20180327/fa1ef204/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: application/octet-stream
Size: 863 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180327/fa1ef204/attachment.obj>

More information about the osg-users mailing list