@@ -18,6 +18,7 @@ import qualified Data.List as List
1818import qualified Data.Map as Map
1919import qualified Data.Name as Name
2020import qualified Data.Set as Set
21+import qualified System.Directory as Dir
2122import System.FilePath ((</>))
2223
2324import qualified Deps.Website as Website
@@ -356,7 +357,8 @@ changeMagnitude (Changes added changed removed) =
356357
357358getDocs :: Stuff.PackageCache -> Http.Manager -> Pkg.Name -> V.Version -> IO (Either Exit.DocsProblem Docs.Documentation)
358359getDocs 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"
360362 exists <- File.exists path
361363 if exists
362364 then
@@ -373,7 +375,8 @@ getDocs cache manager name version =
373375 Http.get manager url [] Exit.DP_Http $ \body ->
374376 case D.fromByteString Docs.decoder body of
375377 Right docs ->
376− do File.writeUtf8 path body
378+ do Dir.createDirectoryIfMissing True home
379+ File.writeUtf8 path body
377380 return $ Right docs
378381
379382 Left _ ->