From c5f71933f60beab372dc8f21635d9b00ab4e21ad Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Fri, 3 Jul 2015 20:29:07 +0300 Subject: [PATCH] Canonicalize FilePath before lookup in withMappedFile --- Language/Haskell/GhcMod/Utils.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Haskell/GhcMod/Utils.hs b/Language/Haskell/GhcMod/Utils.hs index 209b983..73d2fed 100644 --- a/Language/Haskell/GhcMod/Utils.hs +++ b/Language/Haskell/GhcMod/Utils.hs @@ -162,7 +162,7 @@ canonFilePath f = do withMappedFile :: (IOish m, GmState m, GmEnv m) => forall a. FilePath -> (FilePath -> m a) -> m a -withMappedFile file action = lookupMMappedFile file >>= runWithFile +withMappedFile file action = getCanonicalFileNameSafe file >>= lookupMMappedFile >>= runWithFile where runWithFile (Just (RedirectedMapping to)) = action to runWithFile (Just (MemoryMapping (Just src))) = do @@ -175,7 +175,7 @@ withMappedFile file action = lookupMMappedFile file >>= runWithFile return result runWithFile _ = action file -getCanonicalFileNameSafe :: IOish m => FilePath -> GhcModT m FilePath +getCanonicalFileNameSafe :: (IOish m, GmEnv m) => FilePath -> m FilePath getCanonicalFileNameSafe fn = do crdl <- cradle let ccfn = cradleCurrentDir crdl fn