Tuesday, October 31, 2006

The Golden Path

Just found out today after a few hours of banging my head against a wall that in every version of Windows, you cant have a file path longer than 260 characters.  Thanks to Microsoft's neverending support for the original Win32 API, this bug is not really fixable.  More info can be found at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp

Maximum Path Length

In the Windows API, the maximum length for a path is MAX_PATH, which is defined as 260 characters. A path is structured in the following order: drive letter, colon, backslash, components separated by backslashes, and a null-terminating character, for example, the maximum path on the D drive is D:\<256 chars>NUL.

The Unicode versions of several functions permit a maximum path length of approximately 32,000 characters composed of components up to 255 characters in length. To specify that kind of path, use the "\\?\" prefix.

Of course when you are running a ruby script inside of cygwin inside of windows, getting at those Unicode versioned functions might not be so easy :(