summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2013-11-25 00:51:44 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2013-11-25 00:51:44 +0100
commit21782da09df74bb96128636c10f55bff135d66af (patch)
treec8498914b964a9783d557c9263fc3cc15f9b3d60 /src
parentf13249574324ec9198467a6fb7e2337a1836c1ad (diff)
downloadxmobar-21782da09df74bb96128636c10f55bff135d66af.tar.gz
xmobar-21782da09df74bb96128636c10f55bff135d66af.tar.bz2
findFiles renamed for directory-1.2.0.2 compat (fixes #137)
Diffstat (limited to 'src')
-rw-r--r--src/Plugins/Monitors/CoreCommon.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/CoreCommon.hs b/src/Plugins/Monitors/CoreCommon.hs
index c7fb7d5..5d6efd4 100644
--- a/src/Plugins/Monitors/CoreCommon.hs
+++ b/src/Plugins/Monitors/CoreCommon.hs
@@ -35,7 +35,8 @@ retrieveData :: (Ord a, Num a)
=> [String] -> Maybe (String, String -> Int)
-> (Double -> a) -> (a -> String) -> Monitor (Maybe String)
retrieveData path lbl trans fmt = do
- pairs <- map snd . sortBy (compare `on` fst) <$> (mapM readFiles =<< findFiles path lbl)
+ pairs <- map snd . sortBy (compare `on` fst) <$>
+ (mapM readFiles =<< findFilesAndLabel path lbl)
if null pairs
then return Nothing
else Just <$> ( parseTemplate
@@ -84,9 +85,9 @@ pathComponents = joinComps . drop 2 . intercalate [Space] . map splitParts
-- | Function to find all files matching the given path and possible label file.
-- The path must be absolute (start with a leading slash).
-findFiles :: [String] -> Maybe (String, String -> Int)
+findFilesAndLabel :: [String] -> Maybe (String, String -> Int)
-> Monitor [(String, Either Int (String, String -> Int))]
-findFiles path lbl = catMaybes
+findFilesAndLabel path lbl = catMaybes
<$> ( mapM addLabel . zip [0..] . sort
=<< recFindFiles (pathComponents path) "/"
)