diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-07-04 14:10:41 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-07-04 14:10:41 +0000 |
| commit | 2b5197d61d69f3843c6de31c9e6aa21243f66cde (patch) | |
| tree | 54cd57fa864f849ae38399ca40aa5571557a189e /src | |
| parent | 51d3ade165a967580f16b41ef3e00cde08c6ff09 (diff) | |
tutorial exercises; put libdir in place in GF/src
Diffstat (limited to 'src')
| -rw-r--r-- | src/GF.hs | 4 | ||||
| -rw-r--r-- | src/GF/Infra/UseIO.hs | 7 |
2 files changed, 6 insertions, 5 deletions
@@ -31,7 +31,7 @@ import GF.Shell.JGF import GF.System.Signal import GF.Text.UTF8 -import GF.Today (today,version) +import GF.Today (today,version,libdir) import GF.System.Arch import System (getArgs,system,getEnv) import Control.Monad (foldM,liftM) @@ -121,7 +121,7 @@ helpMsg = unlines [ welcomeMsgLib = do lib <- catch (getEnv "GF_LIB_PATH" >>= return . ("GF_LIB_PATH is set to" +++)) - (const (return "Warning: GF_LIB_PATH is not defined.")) + (const (return $ "GF_LIB_PATH is set to the default, " ++ libdir)) return $ welcomeMsg lib welcomeMsg lib = diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs index 76563b5ad..dd8ad8d1a 100644 --- a/src/GF/Infra/UseIO.hs +++ b/src/GF/Infra/UseIO.hs @@ -17,6 +17,7 @@ module GF.Infra.UseIO where import GF.Data.Operations import GF.System.Arch (prCPU) import GF.Infra.Option +import GF.Today (libdir) import System.Directory import System.IO @@ -114,8 +115,8 @@ doesFileExistPath paths file = do -- | path in environment variable has lower priority extendPathEnv :: String -> String -> [FilePath] -> IO [FilePath] extendPathEnv lib var ps = do - b <- catch (getEnv lib) (const (return "")) -- e.g. GF_LIB_PATH - s <- catch (getEnv var) (const (return "")) -- e.g. GF_GRAMMAR_PATH + b <- catch (getEnv lib) (const (return libdir)) -- e.g. GF_LIB_PATH + s <- catch (getEnv var) (const (return "")) -- e.g. GF_GRAMMAR_PATH let fs = pFilePaths s let ss = ps ++ fs liftM concat $ mapM allSubdirs $ ss ++ [b ++ "/" ++ s | s <- ss] @@ -322,7 +323,7 @@ readFileLibraryIOE ini f = initPath = addInitFilePath ini f getLibPath :: IO String getLibPath = do { - lp <- getEnv gfLibraryPath; + lp <- catch (getEnv gfLibraryPath) (const (return libdir)) ; return (if isSep (last lp) then lp else lp ++ ['/']); } reportOn f = "File " ++ f ++ " not found." |
