@@ -62,6 +62,7 @@ import Data.Time
6262import Development.IDE.Types.SpanInfo
6363import GHC.Generics (Generic)
6464import System.FilePath
65+import System.Directory
6566
6667-- | 'CoreModule' together with some additional information required for the
6768-- conversion to DAML-LF.
@@ -274,12 +275,14 @@ mkTcModuleResult (WriteInterface writeIface) tcm = do
274275 nc <- liftIO $ readIORef (hsc_NC session)
275276 (iface,_) <- liftIO $ mkIfaceTc session Nothing Sf_None details tcGblEnv
276277 liftIO $ when writeIface $ do
277− writeIfaceFile (hsc_dflags session) (replaceExtension (file tcm) ".hi") iface
278+ let path = ".interfaces" </> file tcm
279+ createDirectoryIfMissing True (takeDirectory path)
280+ writeIfaceFile (hsc_dflags session) (replaceExtension path ".hi") iface
278281 -- For now, we write .hie files whenever we write .hi files which roughly corresponds to
279282 -- when we are building a package. It should be easily decoupable if that turns out to be
280283 -- useful.
281284 hieFile <- runHsc session $ mkHieFile (tcModSummary tcm) tcGblEnv (fromJust $ renamedSource tcm)
282− writeHieFile (replaceExtension (file tcm) ".hie") hieFile
285+ writeHieFile (replaceExtension path ".hie") hieFile
283286 let mod_info = HomeModInfo iface details Nothing
284287 origNc = nsNames nc
285288 case lookupModuleEnv origNc (tcmModule tcm) of