aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-11-15 10:43:43 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-11-15 10:43:43 -0800
commitf8225140a58fa53d5c45ec644b8d5add342ced75 (patch)
tree2848f8b046671a619b6885fac61e8ee153d99e1e
parent79907e5f175cb5661f7e8634ba2003fc9bbee9dd (diff)
downloadpandoc-f8225140a58fa53d5c45ec644b8d5add342ced75.tar.gz
Text.Pandoc.PDF: Fix `changePathSeparators` for Windows.
Previously a path beginning with a drive, like `C:\foo\bar`, was translated to `C:\/foo/bar`, which caused problems. With this fix, the backslashes are removed. Closes #6173.
-rw-r--r--src/Text/Pandoc/PDF.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index 01dc45d24..c4080a227 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -60,7 +60,10 @@ import Text.Pandoc.Logging
#ifdef _WINDOWS
changePathSeparators :: FilePath -> FilePath
-changePathSeparators = intercalate "/" . splitDirectories
+changePathSeparators =
+ -- We filter out backslashes because an initial `C:\` gets
+ -- retained by `splitDirectories`, see #6173:
+ intercalate "/" . map (filter (/='\\')) . splitDirectories
#endif
makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex,