From 82a8c61cf691b6639a1be506382ecec77d2ce959 Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Thu, 24 Jun 2021 10:54:38 +0530 Subject: [PATCH] adds bin dir removal code, checking for XDG --- lib/GHCup.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 12f2c12..c2be448 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -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