On 02/03/2012 04:55 PM, Chris Hanson wrote:
Ran into a problem where models made on a Windows box didn't work on a
Linux box because the modeler had stored texture filenames in the file
in one case "foo.jpg" and the actual image file was a different case
"foo.JPG".
Obviously the solution is to fix the model, but unfortunately, I am
dealt the task of dealing with clueless modelers and yet-unborn
clueless models in the wild.
I believe I could rig some code to, in the event of a failure to
locate a file, get a directory listing of each osgDB search path, and
attempt a case-insensitive string compare looking for a file that
matches, and then load that.
My questions are:
Is there a better way to do this or away to do this already?
Is there an osgDB callback that I could hook into that would let me
make one last-ditch effort at finding a file before osgDB gives up?
I suspect I'd have to use something like BOOST::filesystem to do the
directory listing in a portable manner, which means this would be code
that couldn't be in core OSG (because of BOOST), hence the callback.
If there's a better way to do this within core OSG, and it would be a
welcomed submission, I'd be happy to do it that way too. Obviously it
would have to be an optional behavior since not everybody on Linux/OSX
wants artificial case insensitivity.
Hi, Chris,
In case you weren't aware, osgDB::findFileInPath (and it's companion,
findFileInDirectory) has an option for case insensitivity. I had to
deal with a similar problem when I was writing the .mdl plugin
(apparently, Valve's artists didn't care much about matching case,
either). Of course, I had the advantage that I could specify
CASE_INSENSITIVE in the plugin, and know that it would be OK in all
cases. That's probably not true in your case.
Still, if you can figure out a way to hook in your "last-ditch effort",
there's already a tool to help.
--"J"
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org