summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-11-03 23:41:42 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2011-11-03 23:41:42 +0000
commitcc7d8370e73dad1b95704f5f7c0cda66f3a890d7 (patch)
treeb0217c8644a9eba131dc7c0936242c7186fc8846
parentd1dff6a1cc5c505b96391dc609e648699a3a2046 (diff)
Don't require a trailing / for directories
-rwxr-xr-xtt.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/tt.hs b/tt.hs
index 900c776..87e0041 100755
--- a/tt.hs
+++ b/tt.hs
@@ -127,11 +127,15 @@ isPython s = isSuffixOf ".py" s && head s /= '.'
expand :: FilePath -> Bool -> String -> IO [String]
expand testDir inTree s
| isPython s = return [s]
- | "/" `isSuffixOf` s = do
+ | otherwise = do
let srcdir = if inTree then "." else ".."
dir = srcdir </> testDir </> s
- (map (s ++) . filter isPython) <$> getDirectoryContents dir
- | otherwise = return [s ++ ".py"]
+
+ isDirectory <- doesDirectoryExist dir
+
+ if isDirectory
+ then (map (s </>) . filter isPython) <$> getDirectoryContents dir
+ else return [s ++ ".py"]
{- Stupid project-specific crap detection -}
iFuckingHateMissionControl :: IO (Maybe String)