12
votes

On my WinXP (sp3) machine with the GHC Haskell Platform (2013.2.0.0), attempting to compile code results in the following error unless the file in question is contained within a subdirectory, i.e., not root ('C:\'):

Prelude> :l doubleMe.hs
[1 of 1] Compiling Main             ( doubleMe.hs, interpreted )
*** Exception: CreateDirectory ".": permission denied (Access is denied.)

Does anyone know if this is a bug? If so, it has persisted across multiple versions of GHC and I am beginning to suspect storing haskell code in subdirectories on Windows machines is simply a necessity. Is the error reproducible on *nix machines?

Thanks.

~Caitlin

2
Yeah, looks like a bug arising from a subtle difference between windows and unix.luqui
Same on my Win7 machine with the same version of the HP. However, I don't know why you'd be keeping code in C:\ in the first place...bheklilr
@bheklilr Storing source files in root was, admittedly, not the best course of action and was largely a matter of convenience (laziness - and not of the good variety). Thanks for confirming the reproducibility of the issue.CaitlinG
@jberryman It isn't trying to create a subdirectory, it's trying to create the directory ./ in C:/, which Windows doesn't let you do. Why GHC needs to do this, I don't know, but it doesn't work on Windows.bheklilr
Maybe it tries to validate that it is in a usable environment, in all regular folders mkdir . shouldn't do anythings-ol

2 Answers

1
votes

Just for posterity: the issue was GHCi attempting to create temporary files in whatever directory it happened to be running in. If this directory happened to be one with permissions issue (such as the root dir in Windows) then the error was thrown.

0
votes

I'd recommend checking the permissions for the files you're attempting to create. If you're attempting to put them in a restricted area, you'll need additional permissions to do so.