summaryrefslogtreecommitdiff
path: root/hs/src/Handlingar.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hs/src/Handlingar.hs')
-rw-r--r--hs/src/Handlingar.hs13
1 files changed, 5 insertions, 8 deletions
diff --git a/hs/src/Handlingar.hs b/hs/src/Handlingar.hs
index 157e95d..b9a0038 100644
--- a/hs/src/Handlingar.hs
+++ b/hs/src/Handlingar.hs
@@ -5,10 +5,9 @@ module Handlingar
) where
import System.FilePath (dropFileName)
-import System.Posix.Directory (changeWorkingDirectory, getWorkingDirectory)
import Text.Pandoc (runIOorExplode)
import qualified Data.Text.IO as T
-import System.FilePath ((</>))
+import System.Directory (canonicalizePath, createDirectoryIfMissing, withCurrentDirectory)
-- import Handlingar.TexOutput (handleTex)
import Handlingar.HtmlOutput (handleHtml)
@@ -32,14 +31,12 @@ main :: [String] -> IO ()
main args = do
case args of
[file, heading] -> do
-
- here <- getWorkingDirectory
- changeWorkingDirectory $ dropFileName file
+ destination <- canonicalizePath "out"
+ createDirectoryIfMissing True destination
text <- T.readFile file
- -- TODO mkdir
- runIOorExplode $ handleHtml text heading (here </> "out")
- changeWorkingDirectory here
+ withCurrentDirectory (dropFileName file) $ do
+ runIOorExplode $ handleHtml text heading destination
_ -> error "Usage: ./main handlingar <input-file> <heading>"