Simplify upgrade copying logic
This commit is contained in:
parent
da94fa5f92
commit
2be1aa2707
@ -71,9 +71,11 @@ ui AppState {..} =
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
<=> ( withAttr "help"
|
<=> ( withAttr "help"
|
||||||
$ foldr1 (\x y -> x <+> str " " <+> y)
|
. txtWrap
|
||||||
. (++ [str "↑↓:Navigation"])
|
. T.pack
|
||||||
$ (fmap (\(c, s, _) -> str (c : ':' : s)) keyHandlers)
|
. foldr1 (\x y -> x <> " " <> y)
|
||||||
|
. (++ ["↑↓:Navigation"])
|
||||||
|
$ (fmap (\(c, s, _) -> (c : ':' : s)) keyHandlers)
|
||||||
)
|
)
|
||||||
|
|
||||||
where
|
where
|
||||||
|
21
lib/GHCup.hs
21
lib/GHCup.hs
@ -928,21 +928,12 @@ upgradeGHCup dls mtarget force = do
|
|||||||
`unionFileModes` groupExecuteMode
|
`unionFileModes` groupExecuteMode
|
||||||
`unionFileModes` otherExecuteMode
|
`unionFileModes` otherExecuteMode
|
||||||
binDir <- liftIO $ ghcupBinDir
|
binDir <- liftIO $ ghcupBinDir
|
||||||
liftIO $ createDirIfMissing newDirPerms binDir
|
let fullDest = fromMaybe (binDir </> fn) mtarget
|
||||||
case mtarget of
|
liftIO $ hideError NoSuchThing $ deleteFile fullDest
|
||||||
Nothing -> do
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
||||||
dest <- liftIO $ ghcupBinDir
|
fullDest
|
||||||
liftIO $ hideError NoSuchThing $ deleteFile (dest </> fn)
|
Overwrite
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
liftIO $ setFileMode (toFilePath fullDest) fileMode'
|
||||||
(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
|
pure latestVer
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user