T.P.Class.IO: normalise path in writeMedia.
This ensures that we get `\` separators on Windows.
This commit is contained in:
parent
a54a19cca5
commit
b6c04383e4
1 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue