summaryrefslogtreecommitdiff
path: root/src/GF/Infra/UseIO.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Infra/UseIO.hs')
-rw-r--r--src/GF/Infra/UseIO.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs
index 243ead306..3dc41fadc 100644
--- a/src/GF/Infra/UseIO.hs
+++ b/src/GF/Infra/UseIO.hs
@@ -81,6 +81,13 @@ doesFileExistPath paths file = do
mpfile <- ioeIO $ getFilePath paths file
return $ maybe False (const True) mpfile
+-- path in environment variable has lower priority
+extendPathEnv :: String -> [FilePath] -> IO [FilePath]
+extendPathEnv var ps = do
+ s <- catch (getEnv var) (const (return ""))
+ let fs = pFilePaths s
+ return $ ps ++ fs
+
pFilePaths :: String -> [FilePath]
pFilePaths s = case span (/=':') s of
(f,_:cs) -> f : pFilePaths cs