[Haskell-cafe] doesDirectoryExist is always returning False

Yitzchak Gale gale at sefer.org
Thu Dec 2 09:22:30 CET 2010

Marcelo Sousa wrote:
>> I'm having currently a problem with System.Directory in my mac os.
>> Prelude System.Directory> let dirTest = do {dir <- getCurrentDirectory;
>> doesDirectoryExist dir}
>> Prelude System.Directory> dirTest
>> False

I.e., System.Directory.doesDirectoryExist always
returns False.

I wrote:
> http://hackage.haskell.org/trac/ghc/ticket/4812

It looks like this problem happens when you upgrade or reinstall the
directory package (any version) after upgrading the unix package to
version on Mac OS X.

Note that the directory package does depend on unix or Win32,
as obviously it must. That dependency can be seen in
directory.cabal, even though it does not show up on hackage.
Thanks to Simon Marlow for clarifying that point.

So a work-around for this problem is:

cabal install --reinstall --constraint='unix ==' directory

If you originally upgraded or reinstalled directory using the
--global flag, you must add it to the above also.

Thanks to Duncan Coutts for this work-around.


More information about the Haskell-Cafe mailing list