This patch resolves the bug 4356.
The problem is with the FindFirstFile behavior:
(Excerpt from win32 SDK)
"You cannot use root directories as the lpFileName input string for FindFirstFile, with or without a trailing backslash. To examine files in a root directory, use something like "C:\*" and step through the directory with FindNextFile. To get the attributes of a root directory, use GetFileAttributes. Prepending the string "\\?\" does not allow access to the root directory."
[..]
"To examine any directory other than a root directory, use an appropriate path to that directory, with no trailing backslash. For example, an argument of "C:\windows" will return information about the directory "C:\windows", not about any directory or file in "C:\windows". An attempt to open a search with a trailing backslash will always fail."
Here are the tests i did:
//Absolutes
WriteLn('DirectoryExists(''C''): ',DirectoryExists('C'));
WriteLn('DirectoryExists(''C:''): ',DirectoryExists('C:'));
WriteLn('DirectoryExists(''C:\''): ',DirectoryExists('C:\'));
WriteLn('DirectoryExists(''C:\AUTOEXEC.BAT''):
',DirectoryExists('C:\AUTOEXEC.BAT'));
WriteLn('DirectoryExists(''C:\thisdoesnotexists''):
',DirectoryExists('C:\thisdoesnotexists'));
WriteLn('DirectoryExists(''C:\Windows''):
',DirectoryExists('C:\Windows'));
WriteLn('DirectoryExists(''C:\Windows\''):
',DirectoryExists('C:\Windows\'));
//Relatives
WriteLn('DirectoryExists(''thisexists''):
',DirectoryExists('thisexists'));
WriteLn('DirectoryExists(''thisdoesnotexists''):
',DirectoryExists('thisdoesnotexists'));
WriteLn('DirectoryExists(''..\thisexists''):
',DirectoryExists('..\thisexists'));
WriteLn('DirectoryExists(''..\thisdoesnotexists''):
',DirectoryExists('..\thisdoesnotexists'));Luiz Américo
