mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-15 04:05:53 -07:00
Fix issue 551 by also getting manpath without -g flag.
Instead of taking Ondrej's approach of figuring out which man (man-db or http://primates.ximian.com/~flucifredi/man/) is used by the system, just try both sets of flags.
This commit is contained in:
@@ -64,11 +64,15 @@ manPrompt c = do
|
|||||||
|
|
||||||
getMans :: IO [String]
|
getMans :: IO [String]
|
||||||
getMans = do
|
getMans = do
|
||||||
paths <- getCommandOutput "manpath -g 2>/dev/null" `E.catch`
|
paths <- do
|
||||||
\(E.SomeException _) -> return []
|
let getout cmd = getCommandOutput cmd `E.catch` \E.SomeException{} -> return ""
|
||||||
|
-- one of these combinations should give some output
|
||||||
|
p1 <- getout "manpath -g 2>/dev/null"
|
||||||
|
p2 <- getout "manpath 2>/dev/null"
|
||||||
|
return $ intercalate ":" $ lines $ p1 ++ p2
|
||||||
let sects = ["man" ++ show n | n <- [1..9 :: Int]]
|
let sects = ["man" ++ show n | n <- [1..9 :: Int]]
|
||||||
dirs = [d ++ "/" ++ s | d <- split ':' paths, s <- sects]
|
dirs = [d ++ "/" ++ s | d <- split ':' paths, s <- sects]
|
||||||
mans <- forM dirs $ \d -> do
|
mans <- forM (nub dirs) $ \d -> do
|
||||||
exists <- doesDirectoryExist d
|
exists <- doesDirectoryExist d
|
||||||
if exists
|
if exists
|
||||||
then map (stripExt . stripSuffixes [".gz", ".bz2"]) `fmap`
|
then map (stripExt . stripSuffixes [".gz", ".bz2"]) `fmap`
|
||||||
|
Reference in New Issue
Block a user