summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-01-10 12:34:21 +0000
committersimonmar <unknown>2005-01-10 12:34:21 +0000
commit038f8bb5d97d018c60c6f19faddbf0ee76775027 (patch)
tree0a30b642b7516e84e3e4a11a17dbb22e30a7753d
parentf13895fc3b7a38c909ee0d2d7c1de24381858024 (diff)
downloadhaskell-038f8bb5d97d018c60c6f19faddbf0ee76775027.tar.gz
[project @ 2005-01-10 12:34:21 by simonmar]
Remove copied definitions for joinFileName, splitFileName: System.FilePath is in libghccompat now.
-rw-r--r--ghc/utils/ghc-pkg/Main.hs46
1 files changed, 2 insertions, 44 deletions
diff --git a/ghc/utils/ghc-pkg/Main.hs b/ghc/utils/ghc-pkg/Main.hs
index 13a4d85e6a..0bc8d44883 100644
--- a/ghc/utils/ghc-pkg/Main.hs
+++ b/ghc/utils/ghc-pkg/Main.hs
@@ -26,6 +26,7 @@ import Compat.Directory ( getAppUserDataDirectory )
import Compat.RawSystem ( rawSystem )
import Control.Exception ( evaluate )
import qualified Control.Exception as Exception
+import System.FilePath ( joinFileName, splitFileName )
import Prelude
@@ -52,8 +53,6 @@ import System ( getArgs, getProgName,
import System.IO
import Data.List ( isPrefixOf, isSuffixOf, intersperse )
-#include "../../includes/ghcconfig.h"
-
#ifdef mingw32_HOST_OS
import Foreign
@@ -77,7 +76,7 @@ main = do
bye (usageInfo (usageHeader prog) flags)
(cli,_,[]) | FlagVersion `elem` cli ->
bye ourCopyright
- (cli@(_:_),nonopts,[]) ->
+ (cli,nonopts,[]) ->
runit cli nonopts
(_,_,errors) -> tryOldCmdLine errors args
@@ -936,46 +935,5 @@ getExecDir :: String -> IO (Maybe String)
getExecDir _ = return Nothing
#endif
--- -----------------------------------------------------------------------------
--- Utils from Krasimir's FilePath library, copied here for now
-
directoryOf :: FilePath -> FilePath
directoryOf = fst.splitFileName
-
-splitFileName :: FilePath -> (String, String)
-splitFileName p = (reverse (path2++drive), reverse fname)
- where
-#ifdef mingw32_TARGET_OS
- (path,drive) = break (== ':') (reverse p)
-#else
- (path,drive) = (reverse p,"")
-#endif
- (fname,path1) = break isPathSeparator path
- path2 = case path1 of
- [] -> "."
- [_] -> path1 -- don't remove the trailing slash if
- -- there is only one character
- (c:path) | isPathSeparator c -> path
- _ -> path1
-
-joinFileName :: String -> String -> FilePath
-joinFileName "" fname = fname
-joinFileName "." fname = fname
-joinFileName dir fname
- | isPathSeparator (last dir) = dir++fname
- | otherwise = dir++pathSeparator:fname
-
-isPathSeparator :: Char -> Bool
-isPathSeparator ch =
-#ifdef mingw32_TARGET_OS
- ch == '/' || ch == '\\'
-#else
- ch == '/'
-#endif
-
-pathSeparator :: Char
-#ifdef mingw32_TARGET_OS
-pathSeparator = '\\'
-#else
-pathSeparator = '/'
-#endif