diff --git a/Cabal/Distribution/Compat/Directory.hs b/Cabal/Distribution/Compat/Directory.hs
index 3fcd64f3d8880c0989ef16bad3a2f449297f9ab6..6bc4b07b8612c9d566e3db7b0accf623d17ec1e3 100644
--- a/Cabal/Distribution/Compat/Directory.hs
+++ b/Cabal/Distribution/Compat/Directory.hs
@@ -1,8 +1,17 @@
 {-# LANGUAGE CPP #-}
 
-module Distribution.Compat.Directory (listDirectory, makeAbsolute) where
-
+module Distribution.Compat.Directory
+( listDirectory
+, makeAbsolute
+, doesPathExist
+) where
+
+#if MIN_VERSION_directory(1,2,7)
+import System.Directory as Dir hiding (doesPathExist)
+import System.Directory (doesPathExist)
+#else
 import System.Directory as Dir
+#endif
 #if !MIN_VERSION_directory(1,2,2)
 import System.FilePath as Path
 #endif
@@ -25,3 +34,11 @@ makeAbsolute p | Path.isAbsolute p = return p
     return $ cwd </> p
 
 #endif
+
+#if !MIN_VERSION_directory(1,2,7)
+
+doesPathExist :: FilePath -> IO Bool
+doesPathExist path = (||) <$> doesDirectoryExist path <*> doesFileExist path
+
+#endif
+