@@ -18,6 +18,7 @@ import qualified Data.List as List
18import qualified Data.Map as Map
18import qualified Data.Map as Map
19import qualified Data.Name as Name
19import qualified Data.Name as Name
20import qualified Data.Set as Set
20import qualified Data.Set as Set
21+import qualified System.Directory as Dir
21import System.FilePath ((</>))
22import System.FilePath ((</>))
23import qualified Deps.Website as Website
24import qualified Deps.Website as Website
@@ -356,7 +357,8 @@ changeMagnitude (Changes added changed removed) =
357getDocs :: Stuff.PackageCache -> Http.Manager -> Pkg.Name -> V.Version -> IO (Either Exit.DocsProblem Docs.Documentation)
358getDocs :: Stuff.PackageCache -> Http.Manager -> Pkg.Name -> V.Version -> IO (Either Exit.DocsProblem Docs.Documentation)
358getDocs cache manager name version =
359getDocs cache manager name version =
359− do let path = Stuff.package cache name version </> "docs.json"
360+ do let home = Stuff.package cache name version
361+ let path = home </> "docs.json"
360 exists <- File.exists path
362 exists <- File.exists path
361 if exists
363 if exists
@@ -373,7 +375,8 @@ getDocs cache manager name version =
373 Http.get manager url [] Exit.DP_Http $ \body ->
375 Http.get manager url [] Exit.DP_Http $ \body ->
374 case D.fromByteString Docs.decoder body of
376 case D.fromByteString Docs.decoder body of
375 Right docs ->
377 Right docs ->
378+ do Dir.createDirectoryIfMissing True home
376− do File.writeUtf8 path body
379+ File.writeUtf8 path body
377 return $ Right docs
380 return $ Right docs
379 Left _ ->
382 Left _ ->