Properly generate directory structure

This commit is contained in:
Evan Czaplicki 2013-09-05 10:55:30 -07:00
parent ae5ef9db97
commit 0976355fac

View file

@ -41,9 +41,9 @@ parseFile path = do
case iParse docs "" source of case iParse docs "" source of
Right json -> do Right json -> do
putStrLn $ "Documenting " ++ path putStrLn $ "Documenting " ++ path
createDirectoryIfMissing True "docs" let docPath = "docs" </> replaceExtension path ".json"
BS.writeFile ("docs" </> replaceExtension path ".json") createDirectoryIfMissing True (dropFileName docPath)
(encodePretty' (defConfig { confIndent = 2 }) json) BS.writeFile docPath (encodePretty' (defConfig { confIndent = 2 }) json)
Left err -> do Left err -> do
putStrLn $ "Parse error in " ++ path ++ " at " ++ show err putStrLn $ "Parse error in " ++ path ++ " at " ++ show err
exitFailure exitFailure