Check file datestamps before unioning PGF files (fix)

Also check that no additional output formats have been selected.
This commit is contained in:
hallgren
2014-01-09 15:14:35 +00:00
parent 40b8c5fb99
commit de5b714573

View File

@@ -16,7 +16,6 @@ import GF.Infra.UseIO
import GF.Infra.Option
import GF.Data.ErrM
import GF.System.Directory
import GF.System.Catch
import Data.Maybe
import Data.Binary
@@ -65,7 +64,10 @@ compileCFFiles opts fs =
writeOutputs opts pgf
unionPGFFiles :: Options -> [FilePath] -> IOE ()
unionPGFFiles opts fs = maybe doIt checkFirst (flag optName opts)
unionPGFFiles opts fs =
if null (outputFormats opts)
then maybe doIt checkFirst (flag optName opts)
else doIt
where
checkFirst name =
do let pgfFile = name <.> "pgf"
@@ -91,10 +93,11 @@ unionPGFFiles opts fs = maybe doIt checkFirst (flag optName opts)
writeOutputs :: Options -> PGF -> IOE ()
writeOutputs opts pgf = do
sequence_ [writeOutput opts name str
| fmt <- flag optOutputFormats opts,
fmt /= FmtByteCode,
| fmt <- outputFormats opts,
(name,str) <- exportPGF opts fmt pgf]
outputFormats opts = [fmt | fmt <- flag optOutputFormats opts, fmt/=FmtByteCode]
writeByteCode :: Options -> PGF -> IOE ()
writeByteCode opts pgf
| elem FmtByteCode (flag optOutputFormats opts) =