From 989a503211a3b9363322d50b74306fc85d1e7c0c Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sat, 13 Mar 2021 18:52:49 +1300 Subject: [PATCH] Ease fixing buildsystem for unexpected current directories. --- src/Input.hs | 2 +- src/Render.hs | 2 +- src/Types.hs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Input.hs b/src/Input.hs index 41df073..9583001 100644 --- a/src/Input.hs +++ b/src/Input.hs @@ -242,7 +242,7 @@ foreign export ccall c_freeSession :: StablePtr Session -> IO () c_newSession = do sess <- newSession - newStablePtr $ sess {aboutPages = map lazify $(embedDir "about")} + newStablePtr $ sess {aboutPages = map lazify $(embedDir $ buildDirFile "about")} where lazify (a, b) = (a, B.fromStrict b) c_freeSession = freeStablePtr diff --git a/src/Render.hs b/src/Render.hs index 01b0100..46af34f 100644 --- a/src/Render.hs +++ b/src/Render.hs @@ -73,7 +73,7 @@ renderElLBS el = XML.renderLBS XML.def $ XML.Document { retreiveStyles :: Session -> CSSCond.ConditionalStyles (CSSTxt.TextStyle SpeechStyle) -> IO (CSSCond.ConditionalStyles (CSSTxt.TextStyle SpeechStyle)) retreiveStyles manager authorStyle = do - let agentStyle = H2C.cssPriorityAgent authorStyle `CSS.parse` $(embedStringFile "useragent.css") + let agentStyle = H2C.cssPriorityAgent authorStyle `CSS.parse` $(embedStringFile $ buildDirFile "useragent.css") userStyle <- loadUserStyles agentStyle CSSCond.loadImports loadURL lowerVars lowerToks userStyle [] where diff --git a/src/Types.hs b/src/Types.hs index ccb367f..a4da66e 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -1,5 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} -module Types(CArray, Page(..), Application(..)) where +module Types(CArray, Page(..), Application(..), buildDirFile) where import System.Directory (getCurrentDirectory) -- default referer URI import SpeechStyle (SpeechStyle) @@ -22,6 +22,9 @@ import Control.Parallel (par) import Foreign.Ptr import Foreign.StablePtr +buildDir = "." +buildDirFile = (buildDir ) + type CArray a = Ptr a data Page = Page { -- 2.30.2