cabal-dir 0.1.0.3 → 0.1.0.4
raw patch · 2 files changed
+14/−8 lines, 2 filesdep +filepath
Dependencies added: filepath
Files
- cabal-dir.cabal +3/−3
- cabal-dir.hs +11/−5
cabal-dir.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: cabal-dir-version: 0.1.0.3+version: 0.1.0.4 stability: Experimental synopsis: show dist dir of 'cabal copy/install' description: @@ -31,10 +31,10 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/cabal-dir.git- tag: 0.1.0.3+ tag: 0.1.0.4 executable cabal-dir main-is: cabal-dir.hs -- other-modules: - build-depends: base > 3 && < 5, directory, Cabal+ build-depends: base > 3 && < 5, directory, Cabal, filepath ghc-options: -Wall
cabal-dir.hs view
@@ -12,6 +12,8 @@ import System.Directory import Data.List +import System.FilePath+ data InstallDirs = InstallDirs { prefix :: FilePath, bindir :: FilePath,@@ -20,8 +22,11 @@ htmldir :: FilePath } deriving Show +configFile :: FilePath+configFile = "dist" </> "setup-config"+ getLocalBuildInfo :: IO LocalBuildInfo-getLocalBuildInfo = read . (!! 1) . lines <$> readFile "./dist/setup-config"+getLocalBuildInfo = read . (!! 1) . lines <$> readFile configFile getPackageDescription :: IO PackageDescription getPackageDescription = packageDescription <$>@@ -51,7 +56,7 @@ libdir = ld, datadir = dd, htmldir = hd } =- "prefix : " ++ px ++ "/\n" +++ "prefix : " ++ px ++ [pathSeparator] ++ "\n" ++ "bindir : " ++ sw bd ++ "\n" ++ "libdir : " ++ sw ld ++ "\n" ++ "datadir: " ++ sw dd ++ "\n" ++@@ -66,12 +71,13 @@ removePrefix :: FilePath -> FilePath -> String removePrefix "" s = s removePrefix p s- | p `isPrefixOf` s = dropWhile (== '/') $ drop (length p) s+ | p `isPrefixOf` s = dropWhile isPathSeparator $ drop (length p) s | otherwise = addCurrent s addCurrent :: FilePath -> FilePath-addCurrent fp@('/' : _) = fp-addCurrent fp = "./" ++ fp+addCurrent fp@(h : _)+ | isPathSeparator h = fp+addCurrent fp = "." ++ [pathSeparator] ++ fp main :: IO () main = do