updates deleting dirs in rmGhcupDirs according to feedback on merge request
This commit is contained in:
parent
118a2744fe
commit
3b3dde8413
37
lib/GHCup.hs
37
lib/GHCup.hs
@ -1348,18 +1348,39 @@ rmGhcupDirs = do
|
||||
$logInfo "Removing Ghcup Environment File"
|
||||
hideError doesNotExistErrorType $ liftIO $ removeFile enFilePath
|
||||
|
||||
rmCacheDir cacheDir = do
|
||||
$logInfo "removing ghcup cache Dir"
|
||||
liftIO $ removeDirectory cacheDir
|
||||
|
||||
rmLogsDir logsDir = do
|
||||
$logInfo "removing ghcup logs Dir"
|
||||
liftIO $ removeDirectory logsDir
|
||||
|
||||
rmConfFile confFilePath = do
|
||||
$logInfo "removing Ghcup Config File"
|
||||
hideError doesNotExistErrorType $ liftIO $ removeFile confFilePath
|
||||
|
||||
rmCacheDir cacheDir = do
|
||||
$logInfo "removing ghcup cache Dir"
|
||||
contents <- liftIO $ listDirectory cacheDir
|
||||
forM_ contents removeIfFile
|
||||
removeDirIfEmpty cacheDir
|
||||
|
||||
rmLogsDir logsDir = do
|
||||
$logInfo "removing ghcup logs Dir"
|
||||
contents <- liftIO $ listDirectory logsDir
|
||||
forM_ contents removeIfFile
|
||||
removeDirIfEmpty logsDir
|
||||
|
||||
removeIfFile filepath = do
|
||||
isFile <- checkIfSymlink filepath
|
||||
isSymlink <- checkIfRegularFile filepath
|
||||
|
||||
if isFile && not isSymlink
|
||||
then liftIO $ removeFile filepath
|
||||
else pure ()
|
||||
|
||||
checkIfSymlink filepath =
|
||||
liftIO $ pathIsSymbolicLink filepath
|
||||
|
||||
checkIfRegularFile filepath =
|
||||
liftIO $ doesFileExist filepath
|
||||
|
||||
removeDirIfEmpty filepath =
|
||||
liftIO $ removeDirectory filepath
|
||||
|
||||
------------------
|
||||
--[ Debug info ]--
|
||||
------------------
|
||||
|
Loading…
Reference in New Issue
Block a user