Hi Paul and Robert, Oh, right! The test should be (backslash!=std::npos && dot<backslash && forwardslash==std::npos && dot<forwardslash), I guess.
But this make me wondering if we shouldn't have two different functions: 1. getNameLessExtension() which removes one extension, stopping on slashes 2. getNameLessAllExtensions() which removes *ALL* extensions, stopping on slashes Thoughts? Going to submit both in a moment... Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ ----- "Paul Martz" <[email protected]> a écrit : > Hi Sukender and Robert -- > > There were a sequence of commits starting with r11165 that appears to > have broken stripping the extension. Backing out FileNameUtils.cpp to > r11164 resolves the issue. > > To reproduce the problem, try this command: > osgviewer cow.osg.5,5,5.trans > > getNameLessExtension is returning the original (extension intact) file > name to the trans pseudoloader, which subsequently emits an error, and > osgviewer exits. > > On svn head, getNameLessExtension stores the position of dot, > forwardslash, and backslash as size_type (unsigned). In this case, > both > forwareslash and backslash are npos (very large unsigned int). The > code > returns the original file name if (dot<backslash && dot<forwardslash). > That evaluates to true in this case, so the original file name is > returned with the extension intact. > > I'm not sure of the exact logic you guys are after with this change, > so > I'll defer to you two to recommend a fix. > -Paul > > > > Sukender wrote: > > You're welcome. > > > > Sukender > > PVLE - Lightweight cross-platform game engine - > http://pvle.sourceforge.net/ > > > > ----- "Robert Osfield" <[email protected]> a écrit : > > > >> Hi Sukender, > >> > >> > >> On Fri, Mar 5, 2010 at 12:10 PM, Sukender < [email protected] > > wrote: > >> > >> > >> Here is a tiny fix for getNameLessExtension(). It does now check > for > >> the presence of slashes ('/' and '\') to avoid changing the string > >> when having a dot in a directory. > >> Old behaviour: "abc.d/filename_no_ext" -> "abc" > >> New behaviour: "abc.d/filename_no_ext" -> "abc.d/filename_no_ext" > >> > >> > >> > >> Change now merged and submitted to svn/trunk. I changed the > variable > >> antiSlash to back_slash so that it has the usual naming form this > type > >> of slash. > >> > >> > >> By the way, I spotted in the same file some > >> filename.find_first_of("://"). At first glance, it seems the goal > is > >> to find "://" substring. If so, the call isn't appropriate since it > >> finds the first occurrence of ":" or "/", and not the first > occurence > >> of the string "://". > >> If confirmed, it may be replaced with "find()". > >> > >> > >> Ooo, does look like it is a bug... I've just replaced > >> find_first_of("://") with find("://"), thanks for the spotting this > >> error. > >> > >> Cheers, > >> Robert. > >> > >> > >> > >> > >> _______________________________________________ > >> osg-submissions mailing list > >> [email protected] > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > _______________________________________________ > > osg-submissions mailing list > > [email protected] > > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
