Ticket #2709 (closed bug: fixed)
System.Directory.doesDirectoryExist "\\" is False on Windows
|Reported by:||Deewiant||Owned by:||igloo|
|Type of failure:||Difficulty:||Unknown|
|Test Case:||Blocked By:|
import System.Directory main = do print =<< doesDirectoryExist "\\" print =<< doesDirectoryExist "\\."
The above prints False followed by True, and both should definitely be True. It seems like it might even be a bug in MinGW or the MSVCRT.
The following does work, giving both as True:
import Data.Bits import System.Win32.Types import System.Win32.File doesDirectoryExist = flip withTString $ \s -> do a <- c_GetFileAttributes s return (a /= 0xffffffff && a.&.fILE_ATTRIBUTE_DIRECTORY /= 0) main = do print =<< doesDirectoryExist "\\" print =<< doesDirectoryExist "\\."