Move getCanonicalFileName(Safe) to Utils module

This commit is contained in:
Nikolay Yakimov
2015-07-03 20:25:54 +03:00
parent 267edfebe3
commit 438b15463e
2 changed files with 12 additions and 14 deletions

View File

@@ -174,3 +174,12 @@ withMappedFile file action = lookupMMappedFile file >>= runWithFile
liftIO $ removeFile fp
return result
runWithFile _ = action file
getCanonicalFileNameSafe :: IOish m => FilePath -> GhcModT m FilePath
getCanonicalFileNameSafe fn = do
crdl <- cradle
let ccfn = cradleCurrentDir crdl </> fn
fex <- liftIO $ doesFileExist ccfn
if fex
then liftIO $ canonicalizePath ccfn
else return ccfn