简体   繁体   中英

How to change path of ghc?

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM