From f8225140a58fa53d5c45ec644b8d5add342ced75 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 15 Nov 2020 10:43:43 -0800 Subject: 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. --- src/Text/Pandoc/PDF.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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, -- cgit v1.2.3