From: David L. <da...@li...> - 2011-08-11 13:43:11
|
Quoting Anton Kovalenko (an...@sw...): > >> Many but not all file I/O APIs support "\\?\"; you should look > >> at the reference topic for each API to be sure. another problem. > > > > Therefore this idea of transparently "deriving" the OS behavior will > > not work: if user doesn't know what API functions we use, he can't > > just pass us \\?\ file name - he doesn't know what OS behavior to rely > > upon. > > SBCL has a manual: indispensible thing for developers to get out of > trouble by blaming the user for not reading it. > > I happen to remember (1) a fair amount of WinAPI functions used by SBCL, > when and where and for what purpose they're used; and (2) important > details about these functions, including it's relation with \\?\. > > There are ~ three places where non-\\?\-capable functions are used, > and it's entirely possible to rewrite them for \\?\-capable API (BTW, > none of these non-capable functions belongs to KERNEL32 -- they are all > MSVCRT). (I've only really followed parts of this discussion, but:) If it is at all possible to make the translation to long native filenames fully transparent to users (at least users who are not explicitly asking SBCL for native namestrings, of course), that's the route we should take. Anything that involves custom hosts or non-equal pathname objects sounds very confusing to me. In particular, there is no reason to assume that a "long" pathname wouldn't be conceptually "short" after doing operations on the pathname object -- or vice versa, and pathname operations are already tricky enough that the burden for correct use of SBCL-specific extensions should not be on users. That means: - Lisp namestrings never have \\?\ in them. - Lisp pathname objects give no indication whether they resulted from parsing \\?\ or not; nor is there a first class value indicating whether they should be unparsed as such. - The decision to write \\?\ in a native namestring is simply dependent on which API we are going to use, and if we want to be backwards-compatible and hand out normal namestrings if possible, we need a reliable predicate to find out that a namestring does not need \\?\. - That predicate is probably just (<= (length x) 259). (The part of the MSDN docs that I don't fully understand is the requirement on directories to not exceed MAX_PATH minus 12 though.) d. |