diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-06-03 18:34:38 -0600 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-06-03 18:34:38 -0600 |
commit | b6c04383e403b0962db09e6748760d3ec376f2ed (patch) | |
tree | 7271016a729012a6ddb5d1e93881ec433c621686 /src/Text/Pandoc/Class | |
parent | a54a19cca5d00378f6103d0bb5a6e3ca2dcfef3c (diff) | |
download | pandoc-b6c04383e403b0962db09e6748760d3ec376f2ed.tar.gz |
T.P.Class.IO: normalise path in writeMedia.
This ensures that we get `\` separators on Windows.
Diffstat (limited to 'src/Text/Pandoc/Class')
-rw-r--r-- | src/Text/Pandoc/Class/IO.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs index f12c0a938..6df39d4d0 100644 --- a/src/Text/Pandoc/Class/IO.hs +++ b/src/Text/Pandoc/Class/IO.hs @@ -211,13 +211,12 @@ writeMedia :: (PandocMonad m, MonadIO m) => FilePath -> MediaBag -> FilePath -> m () writeMedia dir mediabag subpath = do - -- we join and split to convert a/b/c to a\b\c on Windows; - -- in zip containers all paths use / let mbcontents = lookupMedia subpath mediabag case mbcontents of Nothing -> throwError $ PandocResourceNotFound $ pack subpath Just item -> do - let fullpath = dir </> mediaPath item + -- we normalize to get proper path separators for the platform + let fullpath = dir </> normalise (mediaPath item) liftIOError (createDirectoryIfMissing True) (takeDirectory fullpath) logIOError $ BL.writeFile fullpath $ mediaContents item |