Skip to content

Commit

Permalink
Fix upgradeGHCup
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Apr 12, 2020
1 parent fee3984 commit de66b92
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/GHCup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import Prelude hiding ( abs
)
import System.IO.Error
import System.Posix.FilePath ( getSearchPath )
import System.Posix.Files.ByteString

import qualified Data.ByteString as B
import qualified Data.Map.Strict as Map
Expand Down Expand Up @@ -694,18 +695,25 @@ upgradeGHCup dls mtarget = do
tmp <- lift withGHCupTmpDir
let fn = [rel|ghcup|]
p <- liftE $ download dli tmp (Just fn)
let fileMode' =
newFilePerms
`unionFileModes` ownerExecuteMode
`unionFileModes` groupExecuteMode
`unionFileModes` otherExecuteMode
case mtarget of
Nothing -> do
dest <- liftIO $ ghcupBinDir
liftIO $ hideError NoSuchThing $ deleteFile (dest </> fn)
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
(dest </> fn)
Overwrite
liftIO $ setFileMode (toFilePath (dest </> fn)) fileMode'
Just fullDest -> do
liftIO $ hideError NoSuchThing $ deleteFile fullDest
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
fullDest
Overwrite
liftIO $ setFileMode (toFilePath fullDest) fileMode'
pure latestVer


Expand Down

0 comments on commit de66b92

Please sign in to comment.