diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-08-01 21:01:09 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-08-01 21:01:09 +0000 |
commit | 0362298500b2efb7ad3ffe23f57f025573672799 (patch) | |
tree | b298adde0921f948a8ffcb4f3ec75bfc4f6b5333 /Text | |
parent | 26253e475e398f49144143c07a5fddf4bb40be7c (diff) | |
download | pandoc-0362298500b2efb7ad3ffe23f57f025573672799.tar.gz |
ODT writer: Don't use pathname in invoking "zip", as that causes problems in windows.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1363 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text')
-rw-r--r-- | Text/Pandoc/ODT.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Text/Pandoc/ODT.hs b/Text/Pandoc/ODT.hs index c83ccca65..bb49792eb 100644 --- a/Text/Pandoc/ODT.hs +++ b/Text/Pandoc/ODT.hs @@ -30,7 +30,7 @@ Functions for producing an ODT file from OpenDocument XML. -} module Text.Pandoc.ODT ( saveOpenDocumentAsODT ) where import Text.Pandoc.Shared ( contentsOf ) -import Data.Maybe ( fromJust ) +import Data.Maybe ( fromJust, isJust ) import Data.List ( partition, intersperse ) import Prelude hiding ( writeFile, readFile ) import System.IO.UTF8 @@ -44,6 +44,7 @@ import Text.XML.Light.Cursor import Text.Pandoc.Shared ( withTempDir ) import Network.URI ( isURI ) import qualified Data.ByteString.Char8 as B ( writeFile, pack ) +import Control.Monad ( unless ) -- | Produce an ODT file from OpenDocument XML. saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced. @@ -53,11 +54,8 @@ saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced. saveOpenDocumentAsODT destinationODTPath sourceDirRelative xml = do let zipCmd = "zip" -- check for zip in path: - maybeZipPath <- findExecutable zipCmd - let zipPath = case maybeZipPath of - Just p -> p - Nothing -> error $ "The '" ++ zipCmd ++ "' command, which is needed to build an ODT file, " ++ - "was not found.\n" ++ + findExecutable zipCmd >>= \v -> unless (isJust v) $ error $ "The '" ++ zipCmd ++ + "' command, which is needed to build an ODT file, was not found.\n" ++ "It can be obtained from http://www.info-zip.org/Zip.html\n" ++ "Debian (and Debian-based) linux: apt-get install zip\n" ++ "Windows: See http://gnuwin32.sourceforge.net/packages/zip.htm" @@ -70,7 +68,7 @@ saveOpenDocumentAsODT destinationODTPath sourceDirRelative xml = do writeFile (tempDir </> "content.xml") xml' oldDir <- getCurrentDirectory setCurrentDirectory tempDir - let zipCmdLine = zipPath ++ " -9 -q -r " ++ tempODT ++ " " ++ "content.xml Pictures" + let zipCmdLine = "zip -9 -q -r " ++ tempODT ++ " " ++ "content.xml Pictures" ec <- runCommand zipCmdLine >>= waitForProcess -- this requires compilation with -threaded setCurrentDirectory oldDir case ec of |