Further to the following:
http://stackoverflow.com/questions/6996711/how-to-create-directories-in-windows-with-path-length-greater-than-256http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_28013707.htmlhttp://bugs.freepascal.org/view.php?id=24885http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpathhttp://www.freepascal.org/docs-html/rtl/sysutils/createdir.html and
http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/createdirutf8.htmlIn brief, I use ForceDirectoriesUTF8 from fileutil.inc, which utilises CreateDirUTF8 to create directories. And I use FileUtil.CopyFile to copy a file from one directory to another. Works great.
However, as many of us know and as the threads pasted above explain, any directory length of > 260 chars on Windows will cause errors due to the level set by MAX_PATH. But, NTFS allows lengths of around 32,767 chars, due to the need for Unicode etc. So, by use of CreateFileW, it is possible to create file and directory names much longer than 260 chars :
CreateFile :
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming Files, Paths, and Namespaces. My question is, using Lazarus 1.2.6 and FPC 2.6.4 (which I use as my stable programming environment), is there a way to avoid the ANSI limitation of 260 chars? I know it is possible to use CreateFileW combined with prepending paths with \\?\D:\MyDestination but it makes it much more complicated than my current simple implementation of :
if not CreateDirectoryUTF8(MyDestination) then ....
I was hoping there miught be a function somewhere that I can call that basically tells my program to tell Windows "We're not using the ANSI limit length of 260 - we're using the Unicode 32K limit".
Thanks