Simplify upgrade copying logic
This commit is contained in:
parent
62b628cb05
commit
16d4a28454
20
lib/GHCup.hs
20
lib/GHCup.hs
@ -929,20 +929,12 @@ upgradeGHCup dls mtarget force = do
|
|||||||
`unionFileModes` otherExecuteMode
|
`unionFileModes` otherExecuteMode
|
||||||
binDir <- liftIO $ ghcupBinDir
|
binDir <- liftIO $ ghcupBinDir
|
||||||
liftIO $ createDirIfMissing newDirPerms binDir
|
liftIO $ createDirIfMissing newDirPerms binDir
|
||||||
case mtarget of
|
let fullDest = fromMaybe (binDir </> fn) mtarget
|
||||||
Nothing -> do
|
liftIO $ hideError NoSuchThing $ deleteFile fullDest
|
||||||
dest <- liftIO $ ghcupBinDir
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
||||||
liftIO $ hideError NoSuchThing $ deleteFile (dest </> fn)
|
fullDest
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
Overwrite
|
||||||
(dest </> fn)
|
liftIO $ setFileMode (toFilePath fullDest) fileMode'
|
||||||
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
|
pure latestVer
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user