From b6c04383e403b0962db09e6748760d3ec376f2ed Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 3 Jun 2021 18:34:38 -0600 Subject: T.P.Class.IO: normalise path in writeMedia. This ensures that we get `\` separators on Windows. --- src/Text/Pandoc/Class/IO.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3