git.iko.soy/typeable/pandoc
on master help sign in
Make file globbing work on windows.

Windows cmd doesn't expand wildcards; the application has to do this. So on windows we use 'glob' to expand.

commit363ecfebc32c6fe15d81634422e8607847f588fb authorJohn MacFarlane <jgm@berkeley.edu> dateWed 6 Jan 2016, 10:44 (11 years ago) parent73d1175
2 files changed+11−1
pandoc.cabal+2−1 pandoc.hs+9
pandoc.cabal+2−1
@@ -300,7 +300,8 @@ Library
300300 Build-Tools: hsb2hs >= 0.3.1
301301 other-modules: Text.Pandoc.Data
302302 if os(windows)
303− Cpp-options: -D_WINDOWS
303+ Cpp-options: -D_WINDOWS
304+ Build-depends: Glob >= 0.7 && < 0.8
304305 Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind
305306 Ghc-Prof-Options: -fprof-auto-exported -rtsopts
306307 Default-Language: Haskell98
pandoc.hs+9
@@ -73,6 +73,9 @@ import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
7373import Paths_pandoc (getDataDir)
7474import Text.Printf (printf)
7575import Text.Pandoc.Error
76+#ifdef _WINDOWS
77+import System.FilePath.Glob (glob)
78+#endif
7679
7780type Transform = Pandoc -> Pandoc
7881
@@ -1056,7 +1059,13 @@ main = do
10561059
10571060 -- thread option data structure through all supplied option actions
10581061 opts <- foldl (>>=) (return defaultOpts) actions
1062+
1063+-- on windows we need to do our own file globbing, since the shell doesn't.
1064+#ifdef _WINDOWS
1065+ mapM glob args >>= convertWithOpts opts . concat
1066+#else
10591067 convertWithOpts opts args
1068+#endif
10601069
10611070convertWithOpts :: Opt -> [FilePath] -> IO ()
10621071convertWithOpts opts args = do