简体   繁体   English

如何改变ghc的路径?

[英]How to change path of ghc?

I'm using HaskellPlatform-2012.4.0.0 on Win7. 我在Win7上使用HaskellPlatform-2012.4.0.0。 It's installed as portable. 它以便携式方式安装。 Paths are managed through .bat file so ghci and ghc works. 路径通过.bat文件管理,因此ghci和ghc可以工作。 Cabal config and folder are made semi-portable with this. Cabal配置和文件夹由此成为半便携式的

The problem is ghc folder. 问题是ghc文件夹。 It installs itself in C:\\Users\\name\\AppData\\Roaming\\ghc\\i386-mingw32-7.4.1. 它将自身安装在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 :) 因此,我可以在Windows上使用便携式Haskell :)

EDIT: There are 3 new system variables that do nothing. 编辑:有3个新的系统变量不起作用。 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. 您可以尝试SET USERPROFILE=%~dp0同时确保文件夹结构支持Cabal期望的内容。 It is probably attempting to go to %USERPROFILE%AppData\\Roaming or something similar. 它可能正在尝试转到%USERPROFILE%AppData\\Roaming或类似内容。

You can use symbolic links mklink /D linkName target /D means directory symlink. 您可以使用符号链接mklink /D linkName target / D表示目录符号链接。 This command available since Windows Vista/2008+ 从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 有关符号链接的更多信息http://en.wikipedia.org/wiki/NTFS_symbolic_link

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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