Compare commits
1 Commits
master
...
getDirecto
Author | SHA1 | Date | |
---|---|---|---|
3aa164090f |
17
lib/GHCup.hs
17
lib/GHCup.hs
@ -2017,6 +2017,7 @@ rmGhcupDirs = do
|
|||||||
, logsDir
|
, logsDir
|
||||||
, cacheDir
|
, cacheDir
|
||||||
, recycleDir
|
, recycleDir
|
||||||
|
, dbDir
|
||||||
} <- getDirs
|
} <- getDirs
|
||||||
|
|
||||||
let envFilePath = fromGHCupPath baseDir </> "env"
|
let envFilePath = fromGHCupPath baseDir </> "env"
|
||||||
@ -2027,11 +2028,12 @@ rmGhcupDirs = do
|
|||||||
handleRm $ rmConfFile confFilePath
|
handleRm $ rmConfFile confFilePath
|
||||||
|
|
||||||
-- for xdg dirs, the order matters here
|
-- for xdg dirs, the order matters here
|
||||||
handleRm $ rmDir logsDir
|
handleRm $ rmPathForcibly logsDir
|
||||||
handleRm $ rmDir cacheDir
|
handleRm $ rmPathForcibly cacheDir
|
||||||
|
|
||||||
handleRm $ rmBinDir binDir
|
handleRm $ rmBinDir binDir
|
||||||
handleRm $ rmDir recycleDir
|
handleRm $ rmPathForcibly recycleDir
|
||||||
|
handleRm $ rmPathForcibly dbDir
|
||||||
when isWindows $ do
|
when isWindows $ do
|
||||||
logInfo $ "removing " <> T.pack (fromGHCupPath baseDir </> "msys64")
|
logInfo $ "removing " <> T.pack (fromGHCupPath baseDir </> "msys64")
|
||||||
handleRm $ rmPathForcibly (baseDir `appendGHCupPath` "msys64")
|
handleRm $ rmPathForcibly (baseDir `appendGHCupPath` "msys64")
|
||||||
@ -2057,15 +2059,6 @@ rmGhcupDirs = do
|
|||||||
logInfo "removing Ghcup Config File"
|
logInfo "removing Ghcup Config File"
|
||||||
hideErrorDef [permissionErrorType] () $ deleteFile' confFilePath
|
hideErrorDef [permissionErrorType] () $ deleteFile' confFilePath
|
||||||
|
|
||||||
rmDir :: (HasLog env, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => GHCupPath -> m ()
|
|
||||||
rmDir dir =
|
|
||||||
-- 'getDirectoryContentsRecursive' is lazy IO. In case
|
|
||||||
-- an error leaks through, we catch it here as well,
|
|
||||||
-- althought 'deleteFile' should already handle it.
|
|
||||||
hideErrorDef [doesNotExistErrorType] () $ do
|
|
||||||
logInfo $ "removing " <> T.pack (fromGHCupPath dir)
|
|
||||||
liftIO $ flip S.mapM_ (getDirectoryContentsRecursive dir) $ deleteFile' . (fromGHCupPath dir </>)
|
|
||||||
|
|
||||||
rmBinDir :: (MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
rmBinDir :: (MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
||||||
rmBinDir binDir
|
rmBinDir binDir
|
||||||
| isWindows = removeDirIfEmptyOrIsSymlink binDir
|
| isWindows = removeDirIfEmptyOrIsSymlink binDir
|
||||||
|
Loading…
Reference in New Issue
Block a user