From a2bc6c8cbaebe887b46767812ae9faec17129dc7 Mon Sep 17 00:00:00 2001 From: bringert Date: Fri, 20 May 2005 12:12:33 +0000 Subject: [PATCH] Mark platform-specific functions that need to be fixed. --- src/GF/Infra/UseIO.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs index fb5321ce9..7bd586954 100644 --- a/src/GF/Infra/UseIO.hs +++ b/src/GF/Infra/UseIO.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/04/21 16:46:09 $ +-- > CVS $Date: 2005/05/20 13:12:33 $ -- > CVS $Author: bringert $ --- > CVS $Revision: 1.12 $ +-- > CVS $Revision: 1.13 $ -- -- (Description of the module) ----------------------------------------------------------------------------- @@ -107,11 +107,13 @@ extendPathEnv var ps = do let fs = pFilePaths s return $ ps ++ fs +-- FIXME: unix-specific, : is ; on Windows pFilePaths :: String -> [FilePath] pFilePaths s = case span (/=':') s of (f,_:cs) -> f : pFilePaths cs (f,_) -> [f] +-- FIXME: unix-specific, / is \ on Windows prefixPathName :: String -> FilePath -> FilePath prefixPathName p f = case f of '/':_ -> f -- do not prefix [Unix style] absolute paths @@ -119,9 +121,11 @@ prefixPathName p f = case f of "" -> f _ -> p ++ "/" ++ f +-- FIXME: unix-specific, / is \ on Windows justInitPath :: FilePath -> FilePath justInitPath = reverse . drop 1 . dropWhile (/='/') . reverse +-- FIXME: unix-specific, / is \ on Windows nameAndSuffix :: FilePath -> (String,String) nameAndSuffix file = case span (/='.') (reverse file) of (_,[]) -> (file,[]) @@ -136,6 +140,7 @@ fileBody = unsuffixFile fileSuffix :: FilePath -> String fileSuffix = snd . nameAndSuffix +-- FIXME: unix-specific, / is \ on Windows justFileName :: FilePath -> String justFileName = reverse . takeWhile (/='/') . reverse @@ -271,6 +276,7 @@ readFileIOE f = ioe $ catch (readFile f >>= return . return) -- intended semantics: if file is not found, try @\$GF_LIB_PATH\/file@ -- (even if file is an absolute path, but this should always fail) -- it returns not only contents of the file, but also the path used +-- FIXME: unix-specific, / is \ on Windows readFileLibraryIOE :: String -> FilePath -> IOE (FilePath, String) readFileLibraryIOE ini f = ioe $ catch ((do {s <- readFile initPath; return (return (initPath,s))}))