mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 11:19:32 -06:00
tutorial exercises; put libdir in place in GF/src
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user