adds bin dir removal code, checking for XDG

This commit is contained in:
Arjun Kathuria 2021-06-24 10:54:38 +05:30
parent 3fae516ce4
commit 82a8c61cf6

View File

@ -1341,6 +1341,9 @@ rmGhcupDirs = do
-- remove entire logs Dir -- remove entire logs Dir
rmLogsDir logsDir rmLogsDir logsDir
-- remove bin directory conditionally
rmBinDir binDir
liftIO $ print dirs liftIO $ print dirs
where where
@ -1365,6 +1368,16 @@ rmGhcupDirs = do
forM_ contents deleteFile forM_ contents deleteFile
removeDirIfEmpty logsDir removeDirIfEmpty logsDir
rmBinDir binDir = do
#if !defined(IS_WINDOWS)
isXDGStyle <- useXDG
if not isXDGStyle
then removeDirIfEmpty binDir
else pure ()
#else
removeDirIfEmpty binDir
#endif
deleteFile filepath = do deleteFile filepath = do
hideError InappropriateType $ rmFile filepath hideError InappropriateType $ rmFile filepath