remove absNormPathUnix, using my absPathFrom replacement

This commit is contained in:
Joey Hess 2015-01-21 13:37:09 -04:00
parent 32fac4b71b
commit a7f05c007b
2 changed files with 2 additions and 17 deletions

View file

@ -144,11 +144,9 @@ gitAnnexLocation' key r crippled
gitAnnexLink :: FilePath -> Key -> Git.Repo -> IO FilePath
gitAnnexLink file key r = do
currdir <- getCurrentDirectory
let absfile = fromMaybe whoops $ absNormPathUnix currdir file
let absfile = absPathFrom currdir file
loc <- gitAnnexLocation' key r False
relPathDirToFile (parentDir absfile) loc
where
whoops = error $ "unable to normalize " ++ file
{- File used to lock a key's content. -}
gitAnnexContentLock :: Key -> Git.Repo -> GitConfig -> IO FilePath

View file

@ -5,7 +5,7 @@
- License: BSD-2-clause
-}
{-# LANGUAGE PackageImports, CPP #-}
{-# LANGUAGE CPP #-}
module Utility.Path where
@ -24,7 +24,6 @@ import System.Posix.Files
import Utility.Exception
#endif
import qualified "MissingH" System.Path as MissingH
import Utility.Monad
import Utility.UserInfo
@ -65,18 +64,6 @@ simplifyPath path = dropTrailingPathSeparator $
absPathFrom :: FilePath -> FilePath -> FilePath
absPathFrom dir path = simplifyPath (combine dir path)
{- On Windows, this converts the paths to unix-style, in order to run
- MissingH's absNormPath on them. Resulting path will use / separators. -}
absNormPathUnix :: FilePath -> FilePath -> Maybe FilePath
#ifndef mingw32_HOST_OS
absNormPathUnix dir path = MissingH.absNormPath dir path
#else
absNormPathUnix dir path = todos <$> MissingH.absNormPath (fromdos dir) (fromdos path)
where
fromdos = replace "\\" "/"
todos = replace "/" "\\"
#endif
{- takeDirectory "foo/bar/" is "foo/bar". This instead yields "foo" -}
parentDir :: FilePath -> FilePath
parentDir = takeDirectory . dropTrailingPathSeparator