gdritter repos yaml-dir / 47b7e0a
Take basename of files/dirs Getty Ritter 9 years ago
1 changed file(s) with 6 addition(s) and 5 deletion(s). Collapse all Expand all
2424 import System.Directory ( doesDirectoryExist
2525 , getDirectoryContents
2626 )
27 import System.FilePath ((</>))
27 import System.FilePath ((</>), takeBaseName)
2828
2929 filterDir :: IO [String] -> IO [String]
3030 filterDir = fmap (filter go)
165165 vs <- fmap sequence (mapM (parsePath withFile) [path </> k | k <- ks])
166166 case vs of
167167 Left s -> return (Left s)
168 Right vs' -> return (Right (Object (fromList [ (pack k, v)
169 | k <- ks
170 | v <- vs'
171 ])))
168 Right vs' ->
169 return (Right (Object (fromList [ (pack (takeBaseName k), v)
170 | k <- ks
171 | v <- vs'
172 ])))