aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-12-26 04:24:12 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-12-26 04:24:12 +0100
commit609f68f80a50cfcfd3744fab9b72549a7782ca2a (patch)
tree203f0edb701aeb368e84ee12dd131af71f5047d9
parent8070e29e12c532555a11882e91b208ef8d51a107 (diff)
downloadXMonadContrib-609f68f80a50cfcfd3744fab9b72549a7782ca2a.tar.gz
XMonadContrib-609f68f80a50cfcfd3744fab9b72549a7782ca2a.tar.xz
XMonadContrib-609f68f80a50cfcfd3744fab9b72549a7782ca2a.zip
Don't bother checking executable bits of items in $PATH, yields a significant speed-up
darcs-hash:20071226032412-a5988-0de67a84893bbcf766a111afe329d6656fb51887.gz
-rw-r--r--XMonad/Prompt/Shell.hs12
1 files changed, 2 insertions, 10 deletions
diff --git a/XMonad/Prompt/Shell.hs b/XMonad/Prompt/Shell.hs
index 295c0fa..29dba38 100644
--- a/XMonad/Prompt/Shell.hs
+++ b/XMonad/Prompt/Shell.hs
@@ -89,20 +89,12 @@ getCommands :: IO [String]
getCommands = do
p <- getEnv "PATH" `catch` const (return [])
let ds = split ':' p
- fp d f = d ++ "/" ++ f
es <- forM ds $ \d -> do
exists <- doesDirectoryExist d
if exists
- then getDirectoryContents d >>= filterM (isExecutable . fp d)
+ then getDirectoryContents d
else return []
- return . uniqSort . concat $ es
-
-isExecutable :: FilePath ->IO Bool
-isExecutable f = do
- fe <- doesFileExist f
- if fe
- then fmap executable $ getPermissions f
- else return False
+ return . uniqSort . filter ((/= '.') . head) . concat $ es
split :: Eq a => a -> [a] -> [[a]]
split _ [] = []