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.
commitf8225140a58fa53d5c45ec644b8d5add342ced75
authorJohn MacFarlane <jgm@berkeley.edu>
dateSun 15 Nov 2020, 10:43 (6 years ago)
parent79907e5
src/Text/Pandoc/PDF.hs+4−1
@@ -60,7 +60,10 @@ import Text.Pandoc.Logging
6060
6161#ifdef _WINDOWS
6262changePathSeparators :: FilePath -> FilePath
63−changePathSeparators = intercalate "/" . splitDirectories
63+changePathSeparators =
64+ -- We filter out backslashes because an initial `C:\` gets
65+ -- retained by `splitDirectories`, see #6173:
66+ intercalate "/" . map (filter (/='\\')) . splitDirectories
6467#endif
6568
6669makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex,