From ff66f6705c31bab07335ea242005503f5d007dc8 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 2 Jun 2019 10:40:13 +0200 Subject: [PATCH] fix IndexedDB directories not being deleted --- Main.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Main.hs b/Main.hs index 1bbd0d5..ec88a56 100644 --- a/Main.hs +++ b/Main.hs @@ -82,16 +82,19 @@ deleteCookies domains = do deleteData :: [Text] -> Action (Int, [Text]) deleteData whitelist = do webengine <- asks webenginePath - appCache <- liftIO $ getDirectoryFiles (webengine "Application Cache") - indexedDB <- liftIO $ getDirectoryFiles (webengine "IndexedDB") - localStorage <- liftIO $ getDirectoryFiles (webengine "Local Storage") + appCache <- liftIO $ listDirectoryAbs (webengine "Application Cache") + indexedDB <- liftIO $ listDirectoryAbs (webengine "IndexedDB") + localStorage <- liftIO $ listDirectoryAbs (webengine "Local Storage") let entries = appCache ++ indexedDB ++ localStorage badFiles = filterMaybe (fmap unlisted . domain) entries badDomains = mapMaybe domain badFiles - liftIO $ mapM_ removeFile badFiles + liftIO $ mapM_ removePathForcibly badFiles return (length badFiles, nub badDomains) where + listDirectoryAbs :: FilePath -> IO [FilePath] + listDirectoryAbs dir = map (dir ) <$> listDirectory dir + maybeToBool :: Maybe Bool -> Bool maybeToBool Nothing = False maybeToBool (Just x) = x