summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/GetGrammar.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-12-06 15:43:34 +0000
committerhallgren <hallgren@chalmers.se>2013-12-06 15:43:34 +0000
commita98f4aa4be7b72a310a8b5826e3cc82c7edb8f40 (patch)
treea46830579656e347dc6dda7bdd0970e643f6387f /src/compiler/GF/Compile/GetGrammar.hs
parente2fe50e5859cb6ef359c1a08e3bceb3080cd2159 (diff)
Show relative file paths in error messages
This is to avoid one trivial reason for failures in the test suite.
Diffstat (limited to 'src/compiler/GF/Compile/GetGrammar.hs')
-rw-r--r--src/compiler/GF/Compile/GetGrammar.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs
index 10a857bf9..6393d51d2 100644
--- a/src/compiler/GF/Compile/GetGrammar.hs
+++ b/src/compiler/GF/Compile/GetGrammar.hs
@@ -33,18 +33,20 @@ import Data.Char(isAscii)
import Control.Monad (foldM,when,unless)
import System.Cmd (system)
--import System.IO(mkTextEncoding) --,utf8
-import System.Directory(removeFile)
+import System.Directory(removeFile,getCurrentDirectory)
+import System.FilePath(makeRelative)
getSourceModule :: Options -> FilePath -> IOE SourceModule
getSourceModule opts file0 =
- errIn file0 $
+--errIn file0 $
do tmp <- lift $ foldM runPreprocessor (Source file0) (flag optPreprocessors opts)
raw <- lift $ keepTemp tmp
--ePutStrLn $ "1 "++file0
(optCoding,parsed) <- parseSource opts pModDef raw
case parsed of
Left (Pn l c,msg) -> do file <- lift $ writeTemp tmp
- let location = file++":"++show l++":"++show c
+ cwd <- lift $ getCurrentDirectory
+ let location = makeRelative cwd file++":"++show l++":"++show c
raise (location++":\n "++msg)
Right (i,mi0) ->
do lift $ removeTemp tmp