summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra/UseIO.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/GF/Infra/UseIO.hs')
-rw-r--r--src/compiler/GF/Infra/UseIO.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs
index aa0c7d7ff..17894c682 100644
--- a/src/compiler/GF/Infra/UseIO.hs
+++ b/src/compiler/GF/Infra/UseIO.hs
@@ -105,9 +105,26 @@ getSubdirs dir = do
then return (fpath:fs)
else return fs ) [] fs
+--------------------------------------------------------------------------------
justModuleName :: FilePath -> String
justModuleName = dropExtension . takeFileName
+isGFO :: FilePath -> Bool
+isGFO = (== ".gfo") . takeExtensions
+
+gfoFile :: FilePath -> FilePath
+gfoFile f = addExtension f "gfo"
+
+gfFile :: FilePath -> FilePath
+gfFile f = addExtension f "gf"
+
+gf2gfo :: Options -> FilePath -> FilePath
+gf2gfo = gf2gfo' . flag optGFODir
+
+gf2gfo' gfoDir file = maybe (gfoFile (dropExtension file))
+ (\dir -> dir </> gfoFile (takeBaseName file))
+ gfoDir
+--------------------------------------------------------------------------------
splitInModuleSearchPath :: String -> [FilePath]
splitInModuleSearchPath s = case break isPathSep s of
(f,_:cs) -> f : splitInModuleSearchPath cs