HPath.IO.Errors: fix throwDestinationInSource

'canonicalizePath' was missing, making this function far less reliable.
In order for this to work we have to work around circular imports
with a IO.hs-boot file.
This commit is contained in:
Julian Ospald 2016-05-10 00:11:42 +02:00
parent 78a3baeb25
commit 8a28a5dd0f
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 12 additions and 2 deletions

7
src/HPath/IO.hs-boot Normal file
View File

@ -0,0 +1,7 @@
module HPath.IO where
import HPath
canonicalizePath :: Path Abs -> IO (Path Abs)

View File

@ -44,6 +44,10 @@ import GHC.IO.Exception
IOErrorType
)
import HPath
import {-# SOURCE #-} HPath.IO
(
canonicalizePath
)
import HPath.IO.Utils
import System.IO.Error
(
@ -194,8 +198,7 @@ throwDestinationInSource :: Path Abs -- ^ source dir
-> IO ()
throwDestinationInSource source dest = do
dest' <- (\x -> maybe x (\y -> x </> y) $ basename dest)
{- <$> (canonicalizePath $ P.dirname dest) -}
<$> (return $ dirname dest)
<$> (canonicalizePath $ dirname dest)
dids <- forM (getAllParents dest') $ \p -> do
fs <- PF.getSymbolicLinkStatus (fromAbs p)
return (PF.deviceID fs, PF.fileID fs)