Fix ghcup upgrade if binary is in non-standard location

This commit is contained in:
Julian Ospald 2021-06-13 15:08:31 +02:00
parent 08b0ecd057
commit 41783ff027
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
1 changed files with 3 additions and 1 deletions

View File

@ -1644,7 +1644,9 @@ upgradeGHCup mtarget force = do
liftIO $ hideError NoSuchThing $ rmFile tempGhcup
lift $ $(logDebug) [i|mv #{destFile} #{tempGhcup}|]
liftIO $ Win32.moveFileEx destFile (Just tempGhcup) 0
-- NoSuchThing may be raised when we're updating ghcup from
-- a non-standard location
liftIO $ hideError NoSuchThing $ Win32.moveFileEx destFile (Just tempGhcup) 0
lift $ $(logDebug) [i|cp #{p} #{destFile}|]
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
destFile