On 1/17/16, Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote: > Yes, that's true. > Additional checks (i.e. for dots) are needed > but I think it should be possible to find out > when a path is: > > 1. not relative and
Yes. > 2. without forward slashes and But then the function would not act on \\?\C:\maxpathchars\foo/bar if you omitted the \\?\, which seems to be the intention of your proposal? Mind you that the \\?\ prefix is not only meant for the MaxPath situation. If I understood you correctly you would want to have function FileXXXUtf8(Fn) do: begin if (Length(Fn) > MaxPath) and (not StartsWith('\\?\',Fn) then FileXXXUtf8('\\?\' + Fn) else OriginalImplementationOfFileXXXUtf8() end; (With the exception of ExpandFilenameUtf8) > 3. too long to be resolved without prepended \\?\ > > so that adding \\?\ would make the request successful > when it otherwise would fail. See above. At least it would be ambigous. To me, the better solution would be that a program that must be able to handle this should prepend the prefix itself (and taking care of all relevant issues like expanding, allowing/replacing '/' with '\' etc. beforehand) and then call the FileXXXUtf8 functions on the resulting string. You, as the programmer, should know wether or not the input in your program can rely on '/' meaning "current system pathdelimiter" or not. E.g. Lazarus itself treats '/' as pathdelimiter (at least in may places), and therefore automatic use of \\?\ prefix may be dangerous (because failing would be a better option than succeding with a "strange" filename). (Or it may not be, I simply cannot tell without studying all the sources.) Bart -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus