From 267edfebe3a3e14d363213fe3ace290f34de4705 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Fri, 3 Jul 2015 19:35:22 +0300 Subject: [PATCH] Try best-guess tactic if file to be redirected doesn't exist --- Language/Haskell/GhcMod/FileMapping.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Language/Haskell/GhcMod/FileMapping.hs b/Language/Haskell/GhcMod/FileMapping.hs index 8904efa..93f7cb1 100644 --- a/Language/Haskell/GhcMod/FileMapping.hs +++ b/Language/Haskell/GhcMod/FileMapping.hs @@ -52,7 +52,10 @@ getCanonicalFileName :: IOish m => FilePath -> GhcModT m FilePath getCanonicalFileName fn = do crdl <- cradle let ccfn = cradleCurrentDir crdl fn - liftIO $ canonicalizePath ccfn + fex <- liftIO $ doesFileExist ccfn + if fex + then liftIO $ canonicalizePath ccfn + else return ccfn unloadMappedFile :: IOish m => FilePath -> GhcModT m () unloadMappedFile = (delMMappedFile =<<) . getCanonicalFileName