diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-11-03 23:41:42 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-11-03 23:41:42 +0000 |
commit | cc7d8370e73dad1b95704f5f7c0cda66f3a890d7 (patch) | |
tree | b0217c8644a9eba131dc7c0936242c7186fc8846 | |
parent | d1dff6a1cc5c505b96391dc609e648699a3a2046 (diff) |
Don't require a trailing / for directories
-rwxr-xr-x | tt.hs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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) |