@@ -31,11 +31,11 @@ import System.Directory (doesDirectoryExist, doesFileExist,
3131import Control.Monad (filterM)
3232import qualified Data.ByteString as B
3333import qualified Data.ByteString.Char8 as B8
34−import Control.Arrow ((&&&), second, first)
34+import Control.Arrow ((&&&), second)
3535import Control.Applicative ((<$>))
36−import Data.Monoid (mappend)
3736import Data.ByteString.Unsafe (unsafePackAddressLen)
3837import System.IO.Unsafe (unsafePerformIO)
38+import System.FilePath ((</>))
3939
4040-- | Embed a single file in your source code.
4141--
@@ -90,14 +90,12 @@ notHidden ('.':_) = False
9090notHidden _ = True
9191
9292fileList :: FilePath -> IO [(FilePath, B.ByteString)]
93−fileList top = map (first tail) <$> fileList' top ""
93+fileList top = fileList' top ""
9494
9595fileList' :: FilePath -> FilePath -> IO [(FilePath, B.ByteString)]
9696fileList' realTop top = do
97− let prefix1 = top ++ "/"
98− prefix2 = realTop ++ prefix1
99− allContents <- filter notHidden <$> getDirectoryContents prefix2
100− let all' = map (mappend prefix1 &&& mappend prefix2) allContents
97+ allContents <- filter notHidden <$> getDirectoryContents (realTop </> top)
98+ let all' = map ((top </>) &&& (\x -> realTop </> top </> x)) allContents
10199 files <- filterM (doesFileExist . snd) all' >>=
102100 mapM (liftPair2 . second B.readFile)
103101 dirs <- filterM (doesDirectoryExist . snd) all' >>=