Skip to content

ghcup run --install fails on windows if temp directory is on a different drive to ghcup trash directory

ghcup run --ghc 9.2.1 --install

Succeeds once then fails on every subsequent attempt, it can't rename the temporary file in %LocalAppData%\Temp to trash under my ghcup directory which is on another drive. This is probably caused by using renameFile, which according to the docs "A conformant implementation need not support renaming files in all situations (e.g. renaming across different physical devices)". According to one of the maintainers, this is intended (https://github.com/haskell/directory/issues/132). Edit: I hadn't noticed but ghcup also uses MoveFileEx from win32 directly.

ghcup: MoveFileEx "C:\\Users\\<user>\\AppData\\Local\\Temp\\ghcup-ghc-9.2.1\\unlit-9.2.1.exe" Just "D:\\ghcup\\trash\\recycleFile-5e463f47d9577333\\unlit-9.2.1.exe": unsupported operation (The system cannot move the file to a different disk drive.)

Originally encountered from the pre-release of the vscode haskell extension, which calls a similar command (with extra flags for HLS and cabal)

Edited by Jashweii
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information