support older directory without CPP

This commit is contained in:
Adam C. Foltzer 2015-10-16 14:48:17 -07:00
parent 3168bef3fa
commit dfea6365f9
2 changed files with 11 additions and 2 deletions

View File

@ -50,7 +50,7 @@ library
async >= 2.0,
containers >= 0.5,
deepseq >= 1.3,
directory >= 1.2.2,
directory >= 1.2,
filepath >= 1.3,
gitrev >= 1.0,
generic-trie >= 0.3.0.1,

View File

@ -37,7 +37,16 @@ import System.FilePath (takeDirectory,(</>),isAbsolute)
import GHC.Generics (Generic)
import Control.DeepSeq
import System.Directory (makeAbsolute)
import System.Directory (getCurrentDirectory)
import System.FilePath (isRelative, normalise)
-- from the source of directory-1.2.2.1; included to maintain
-- backwards compatibility
makeAbsolute :: FilePath -> IO FilePath
makeAbsolute = fmap normalise . absolutize
where absolutize path
| isRelative path = fmap (</> path) getCurrentDirectory
| otherwise = return path
removeIncludesModule :: FilePath -> Module PName -> IO (Either [IncludeError] (Module PName))
removeIncludesModule modPath m = runNoIncM modPath (noIncludeModule m)