Try best-guess tactic if file to be redirected doesn't exist

This commit is contained in:
Nikolay Yakimov 2015-07-03 19:35:22 +03:00
parent a0cf585939
commit 267edfebe3

View File

@ -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