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
1 changed files with 13 additions and 0 deletions

View File

@ -1341,6 +1341,9 @@ rmGhcupDirs = do
-- remove entire logs Dir
rmLogsDir logsDir
-- remove bin directory conditionally
rmBinDir binDir
liftIO $ print dirs
where
@ -1365,6 +1368,16 @@ rmGhcupDirs = do
forM_ contents deleteFile
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
hideError InappropriateType $ rmFile filepath