#2709: System.Directory.doesDirectoryExist "\\" is False on Windows
---------------------------------+------------------------------------------
    Reporter:  Deewiant          |       Owner:                     
        Type:  bug               |      Status:  new                
    Priority:  normal            |   Component:  libraries/directory
     Version:  6.10.1            |    Severity:  normal             
    Keywords:                    |    Testcase:                     
Architecture:  Unknown/Multiple  |          Os:  Windows            
---------------------------------+------------------------------------------
 {{{
 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 "\\."
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2709>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to