Hi Guys, I see that this thread never came to a conclusion, Michael didn't reply w.r.t testing Sukenders changes. I'm not a windows dev so can't make best judgments on what to do about Windows issues so I have rely upon those who know better to thrash things out.
What is the current status? Robert. On 6 September 2012 17:32, Sukender <[email protected]> wrote: > Hi Robert and Michael, > > I'm resurrecting an old Windows issue about paths! > > osgDB::getRealPath() actually uses a trick to "canonicalize" a path: it > converts it to DOS-style (8.3 short names), then re-converts it to the full > (long) name. > However, from Windows 7 and Windows Server 2008 R2, short names (8.3) can be > DISABLED (Source: > http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#short_vs._long_names > ). The long->short->long conversion used here to canonicalize is therefore > NOT the way to do it. > > I tried to figure out how to do it in a clean way, but found no way to > resolve symlinks as realpath(): > - _fullpath() is almost the same as GetFullPathNameW() (removes '.' and > '..') > - GetFinalPathNameByHandleW() shamefully failed resolving a symlink during > a test. > - GetFileInformationByHandleEx() did not work at all. > > Do you think getRealPath() could simply remove '.' and '..', as it docs says? > That way, we could have a much shorter function. > My test seems successful where the current function fails (Modified > FileNameUtils.cpp is attached, in case you would like to have a look). > > Thoughts? > Michael have you a few minutes to give a test? > > Sukender > > ----- Mail original ----- > De: "Robert Osfield" <[email protected]> > À: "OpenSceneGraph Submissions" <[email protected]> > Envoyé: Jeudi 10 Mars 2011 11:53:00 > Objet: Re: [osg-submissions] Fix for Windows implementation > osgDB::getRealPath() > > Thanks Michael, changes now merged and submitted to svn/trunk. > > On Tue, Feb 15, 2011 at 12:32 PM, Michael Platings <[email protected]> > wrote: >> 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 > > _______________________________________________ > 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
