hsb2hs 0.2 → 0.3
raw patch · 2 files changed
+6/−5 lines, 2 files
Files
- hsb2hs.cabal +1/−1
- hsb2hs.hs +5/−4
hsb2hs.cabal view
@@ -1,5 +1,5 @@ Name: hsb2hs-Version: 0.2+Version: 0.3 Synopsis: Preprocesses a file, adding blobs from files as string literals. Description: hsb2hs is a preprocessor that allows you to include the contents of
hsb2hs.hs view
@@ -50,7 +50,7 @@ -- fileList' is taken from Michael Snoyman's file-embed fileList' :: FilePath -> FilePath -> IO [(FilePath, B.ByteString)] fileList' realTop top = do- allContents <- filter notHidden <$> getDirectoryContents (realTop </> top)+ allContents <- filter isReal <$> getDirectoryContents (realTop </> top) let all' = map ((top </>) &&& (\x -> realTop </> top </> x)) allContents files <- filterM (doesFileExist . snd) all' >>= mapM (liftPair2 . second B.readFile)@@ -58,9 +58,10 @@ mapM (fileList' realTop . fst) return $ concat $ files : dirs -notHidden :: FilePath -> Bool-notHidden ('.':_) = False-notHidden _ = True+isReal :: FilePath -> Bool+isReal "." = False+isReal ".." = False+isReal _ = True liftPair2 :: Monad m => (a, m b) -> m (a, b) liftPair2 (a, b) = b >>= \b' -> return (a, b')