git.iko.soy/typeable/pandoc
on master help sign in
Shared: add uriPathToPath.
3a291daJohn MacFarlane
src/Text/Pandoc/Shared.hs+14
@@ -84,6 +84,7 @@ module Text.Pandoc.Shared (
84 -- * File handling
84 -- * File handling
85 inDirectory,
85 inDirectory,
86 collapseFilePath,
86 collapseFilePath,
87+ uriPathToPath,
87 filteredFilesFromArchive,
88 filteredFilesFromArchive,
88 -- * URI handling
89 -- * URI handling
89 schemes,
90 schemes,
@@ -635,6 +636,19 @@ collapseFilePath = Posix.joinPath . reverse . foldl go [] . splitDirectories
635 isSingleton _ = Nothing
636 isSingleton _ = Nothing
636 checkPathSeperator = fmap isPathSeparator . isSingleton
637 checkPathSeperator = fmap isPathSeparator . isSingleton
637
638
639+-- Convert the path part of a file: URI to a regular path.
640+-- On windows, @/c:/foo@ should be @c:/foo@.
641+-- On linux, @/foo@ should be @/foo@.
642+uriPathToPath :: String -> FilePath
643+uriPathToPath path =
644+#ifdef _WINDOWS
645+ case path of
646+ '/':ps -> ps
647+ _ -> p
648+#else
649+ path
650+#endif
651+
638--
652--
639-- File selection from the archive
653-- File selection from the archive
640--
654--