Bugzilla – Bug 37
absolute_file_name/3 does not handle long windows path names properly
Last modified: 2012-06-01 14:57:42 CEST
maybe it is possible to make SWI-Prolog long-path-name-ready in
(very) small chunks :-)
Version 6.0.2, Windows XP, 32-Bit.
3 ?- absolute_file_name('\\\\?\\d:\\tmp\\x.tmp', , Abs).
Abs = '/?/d:/tmp/x.tmp'.
It should be
Abs = '//?/d:/tmp/x.tmp'
That is not entirely clear. The idea behind absolute_file_name/2 is that it
produces a canonical name for a file. Surely, the current answer is wrong,
but it could well be that the correct answer is d:/tmp/x.tmp. The alternative
would be to map d:/tmp/x.tmp to //?/d:/tmp/x.tmp ...
At the moment, it is not really clear to me what the status of //?/ should be.
Its also not really clear to me what it really means. From the docs, I
that it stops mapping / to \. That is irrelevant to us because SWI-Prolog maps
/ to \. I guess it also does something with the old 8+3 name interface, but
is pretty much irrelevant in the Windows world as well nowadays.
For short, can't we just strip "//?/"? That doesn't fix the problem with long
pathnames, but some initial tests shows that size_file/2 stops at 260
regardless of whether one uses //?/ or not. This seems to be a limitation of
the MSVC runtime stat() function (we use _wstati64()), although I have not
a document that confirms this.
Otherwise, I guess the most sensible way is for you to establish a list of
around the long name notation (//?/) and PATH_MAX (260 chars).
Cheers --- Jan