summaryrefslogtreecommitdiff
path: root/src/GF/Compile.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-10-06 10:27:34 +0000
committerkrasimir <krasimir@chalmers.se>2009-10-06 10:27:34 +0000
commitcbcdae91484a13780a3d827a1b6ae85f7e3a9ab3 (patch)
treec796c0e036905810fae1d2c4005bcea67be68a4c /src/GF/Compile.hs
parent332dbf7b9b79f9cb2fa60212cc5529e0c490c1de (diff)
hopefully the last revision of the relative paths handling algorithm
Diffstat (limited to 'src/GF/Compile.hs')
-rw-r--r--src/GF/Compile.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/GF/Compile.hs b/src/GF/Compile.hs
index 0b928d430..ce9a051fd 100644
--- a/src/GF/Compile.hs
+++ b/src/GF/Compile.hs
@@ -114,9 +114,11 @@ compileModule :: Options -- ^ Options from program command line and shell comman
compileModule opts1 env file = do
file <- getRealFile file
opts0 <- getOptionsFromFile file
- let opts = addOptions opts0 opts1
- let fdir = dropFileName file
- ps <- ioeIO $ extendPathEnv opts fdir
+ curr_dir <- return $ dropFileName file
+ lib_dir <- ioeIO $ getLibraryDirectory (addOptions opts0 opts1)
+ let opts = addOptions (fixRelativeLibPaths curr_dir lib_dir opts0) opts1
+ ps0 <- ioeIO $ extendPathEnv opts
+ let ps = nub (curr_dir : ps0)
ioeIO $ putIfVerb opts $ "module search path:" +++ show ps ----
let (_,sgr,rfs) = env
files <- getAllFiles opts ps rfs file
@@ -125,13 +127,13 @@ compileModule opts1 env file = do
ioeIO $ putIfVerb opts $ "modules to include:" +++ show names ----
foldM (compileOne opts) (0,sgr,rfs) files
where
- getRealFile file1 = do
- exists <- ioeIO $ doesFileExist file1
+ getRealFile file = do
+ exists <- ioeIO $ doesFileExist file
if exists
then return file
else if isRelative file
- then do libpath <- ioeIO $ getLibraryPath opts1
- let file1 = libpath </> file
+ then do lib_dir <- ioeIO $ getLibraryDirectory opts1
+ let file1 = lib_dir </> file
exists <- ioeIO $ doesFileExist file1
if exists
then return file1