git.iko.soy/typeable/pandoc
on master help sign in
Cleaned up findPandoc.
commit4ac036fe13928d31b2b84d4143891ad0831f0455 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 4 Jan 2019, 20:14 (8 years ago) parentfc87925
1 file changed+5−11
test/Tests/Helpers.hs+5−11
test/Tests/Helpers.hs+5−11
@@ -79,16 +79,11 @@ showDiff (l,r) (Both _ _ : ds) =
7979 showDiff (l+1,r+1) ds
8080
8181-- | Find pandoc executable relative to test-pandoc
82−-- First, try in same directory (e.g. if both in ~/.cabal/bin)
83−-- Second, try ../pandoc (e.g. if in dist/XXX/build/test-pandoc)
8482findPandoc :: IO FilePath
8583findPandoc = do
8684 testExePath <- getExecutablePath
87− curdir <- getCurrentDirectory
88− let relTestExePathParts = splitDirectories $ makeRelative curdir $
89− takeDirectory testExePath
90− let pandocPath =
91− (case reverse relTestExePathParts of
85+ let pandocDir =
86+ case reverse (splitDirectories (takeDirectory testExePath)) of
9287 -- cabalv2 with --disable-optimization
9388 "test-pandoc" : "build" : "noopt" : "test-pandoc" : "t" : ps
9489 -> joinPath (reverse ps) </>
@@ -100,11 +95,10 @@ findPandoc = do
10095 -- cabalv1
10196 "test-pandoc" : "build" : ps
10297 -> joinPath (reverse ps) </> "build" </> "pandoc"
103− _ -> error $ "findPandoc: could not find pandoc executable")
98+ _ -> error $ "findPandoc: could not find pandoc executable"
99+ let pandocPath = pandocDir </> "pandoc"
104100#ifdef _WINDOWS
105− </> "pandoc" <.> "exe"
106−#else
107− </> "pandoc"
101+ <.> "exe"
108102#endif
109103 found <- doesFileExist pandocPath
110104 if found