Hi Michael, I haven't tested your code yet, but may I suggest to use the macros from FileUtils.cpp, as I put in my submission (such as OSGDB_STRING_TO_FILENAME, OSGDB_FILENAME_TO_STRING...)? Anyway, if it works as expected, that's nice. Thanks for the submission.
About the functions I coded, do you think they should be kept and exposed in the header (I mean only the pertinent ones), or simply removed? Cheers, Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ ----- "Michael Platings" <[email protected]> a écrit : > Hi Robert & Sukender, > I'm guessing that the stack corruption was caused by calling > GetFullPathNameW with the nBufferLength argument as the number of > bytes in the buffer, rather than the number of characters. I've > attached code that uses GetFullPathNameW et al. with _countof() rather > than sizeof() and this works fine. > Cheers > Michael > > > On 14 February 2011 12:24, Robert Osfield < [email protected] > > wrote: > > > Hi Sukender and Michael, > > Michael could you review Sukender's changee and make comments as I > can't provide expertise on the Win32 side so have to defer to the > community. > > Thanks, > Robert. > > On Fri, Feb 11, 2011 at 9:08 AM, Sukender < [email protected] > wrote: > > Hi Michael and Robert, > > > > Here is the modified submission. Thoughts? > > > > Sukender > > PVLE - Lightweight cross-platform game engine - > http://pvle.sourceforge.net/ > > > > ----- "Sukender" < [email protected] > a écrit : > > > >> You're absolutely right, Michael, but the function is called only > for > >> complete paths. I'll make a tiny change in order to make it clearer > >> (or make the function more general). > >> > >> Sukender > >> PVLE - Lightweight cross-platform game engine - > >> http://pvle.sourceforge.net/ > >> > >> ----- "Michael Platings" < [email protected] > a écrit : > >> > >> > Hi Sukender, > >> > I just had a quick look at this and if I'm reading it right, > valid > >> > paths such as "..\..\folder\thing.osg" would cause a warning in > >> > cleanPath() and would return an incorrect path. > >> > > >> > > >> > On 10 February 2011 16:05, Sukender < [email protected] > wrote: > >> > > >> > > >> > Hi Robert, > >> > > >> > This is kind of tricky submission... I found that the current > >> > getRealPath() implementation for Windows doesn't work well with > UTF8 > >> > paths. So I tried to add the support using Unicode Windows API > >> calls. > >> > But unfortunately, the GetFullPathNameW() *corrupts the stack*! > >> Yes... > >> > I've done multiple tries and each with the same conclusion. I > added > >> a > >> > detailed comment about this, and finally wrote my own > implementation > >> > of this Windows API function. So you'll find: > >> > - getFullPathName(), a replacement for GetFullPathNameA() and > >> > GetFullPathNameW() > >> > - cleanPath(), which simply removes "." and ".." from a path > >> > - and a modified getRealPath() > >> > > >> > This is a bit risky as this is quite low level. Moreover I cannot > be > >> > sure this submission 100% works in all cases, and I do not have > >> access > >> > to more robust impementations (ie. C++0x or boost::filesystem). > >> > Please tell me if it seems okay for you. > >> > > >> > File modified: rev.12156. > >> > > >> > Cheers, > >> > > >> > Sukender > >> > PVLE - Lightweight cross-platform game engine - > >> > http://pvle.sourceforge.net/ > >> > > >> > _______________________________________________ > >> > 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 > > > > > _______________________________________________ > 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
