on master help sign in
Properly generate directory structure
0976355Evan Czaplicki
compiler/Docs.hs+3−3
@@ -41,9 +41,9 @@ parseFile path = do
41 case iParse docs "" source of
41 case iParse docs "" source of
42 Right json -> do
42 Right json -> do
43 putStrLn $ "Documenting " ++ path
43 putStrLn $ "Documenting " ++ path
44+ let docPath = "docs" </> replaceExtension path ".json"
44− createDirectoryIfMissing True "docs"
45+ createDirectoryIfMissing True (dropFileName docPath)
45− BS.writeFile ("docs" </> replaceExtension path ".json")
46− (encodePretty' (defConfig { confIndent = 2 }) json)
46+ BS.writeFile docPath (encodePretty' (defConfig { confIndent = 2 }) json)
47 Left err -> do
47 Left err -> do
48 putStrLn $ "Parse error in " ++ path ++ " at " ++ show err
48 putStrLn $ "Parse error in " ++ path ++ " at " ++ show err
49 exitFailure
49 exitFailure