How to change path of ghc?
Asked Answered
K

2

6

I'm using HaskellPlatform-2012.4.0.0 on Win7. It's installed as portable. Paths are managed through .bat file so ghci and ghc works. Cabal config and folder are made semi-portable with this.

The problem is ghc folder. It installs itself in C:\Users\name\AppData\Roaming\ghc\i386-mingw32-7.4.1.

How to change it's default path? So I can have really portable Haskell on windows :)

EDIT: There are 3 new system variables that do nothing. Here are results:

SET APPDATA=%~dp0AppData   -- has no effect. ghc is still made in roaming
SET USERPROFILE=%~dp0  -- kills cabal
SET LOCALAPPDATA=%~dp0Local   --not sure if this is ever used.

kills cabal error link

Koski answered 14/2, 2013 at 2:14 Comment(4)
I think its the same as #14368901Stylize
Not the same, he mentioned that one in his question.Validity
Well, yes. That's my question too ;)Koski
What is the $APPDATA/ghc directory storing? I see a the ghci history, but what's the architecture specific folder?Premillenarian
M
2

You could try SET USERPROFILE=%~dp0 while making sure that the folder structure supports what Cabal expects. It is probably attempting to go to %USERPROFILE%AppData\Roaming or something similar.

Mess answered 26/2, 2013 at 16:33 Comment(1)
Yup, that worked. It's an ugly hack, but it worked. I tried 10 different combinations, but missed that GHC/mingw may have hard coded paths.Koski
C
0

You can use symbolic links mklink /D linkName target /D means directory symlink. This command available since Windows Vista/2008+

cd C:\Users\myself\AppData\Roaming
mklink /D cabal C:\installed\cabal
mklink /D ghc C:\installed\ghc

More info on symlinks http://en.wikipedia.org/wiki/NTFS_symbolic_link

Cavalier answered 4/2, 2014 at 4:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.