[commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Rename isSymbolicLink to pathIsSymbolicLink (ccf402c)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:34:46 UTC 2017


Repository : ssh://git@git.haskell.org/directory

On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ccf402c687eb0a7982507c7451706f2ddaabbab2/directory

>---------------------------------------------------------------

commit ccf402c687eb0a7982507c7451706f2ddaabbab2
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Tue Nov 29 03:05:59 2016 -0500

    Rename isSymbolicLink to pathIsSymbolicLink
    
    A step toward fixing #52.


>---------------------------------------------------------------

ccf402c687eb0a7982507c7451706f2ddaabbab2
 System/Directory.hs                                | 17 ++++++++++++-----
 changelog.md                                       |  6 +++++-
 directory.cabal                                    |  2 +-
 tests/Main.hs                                      |  4 ++--
 tests/{IsSymbolicLink.hs => PathIsSymbolicLink.hs} |  4 ++--
 tests/Util.hs                                      |  4 ++--
 6 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index a4f8ba1..9477e55 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -73,7 +73,7 @@ module System.Directory
     , doesDirectoryExist
 
     -- * Symbolic links
-    , isSymbolicLink
+    , pathIsSymbolicLink
 
     -- * Permissions
 
@@ -101,6 +101,9 @@ module System.Directory
     , setAccessTime
     , setModificationTime
 
+    -- * Deprecated
+    , isSymbolicLink
+
    ) where
 import Control.Exception (bracket, mask, onException)
 import Control.Monad ( when, unless )
@@ -468,7 +471,7 @@ getDirectoryType path =
     isDir <- withFileStatus "getDirectoryType" path isDirectory
     if isDir
       then do
-        isLink <- isSymbolicLink path
+        isLink <- pathIsSymbolicLink path
         if isLink
           then return DirectoryLink
           else return Directory
@@ -1489,9 +1492,9 @@ doesFileExist name =
 -- | Check whether the path refers to a symbolic link.  On Windows, this tests
 -- for @FILE_ATTRIBUTE_REPARSE_POINT at .
 --
--- @since 1.2.6.0
-isSymbolicLink :: FilePath -> IO Bool
-isSymbolicLink path =
+-- @since 1.3.0.0
+pathIsSymbolicLink :: FilePath -> IO Bool
+pathIsSymbolicLink path =
   (`ioeSetLocation` "getDirectoryType") `modifyIOError` do
 #ifdef mingw32_HOST_OS
     isReparsePoint <$> Win32.getFileAttributes path
@@ -1501,6 +1504,10 @@ isSymbolicLink path =
     Posix.isSymbolicLink <$> Posix.getSymbolicLinkStatus path
 #endif
 
+{-# DEPRECATED isSymbolicLink "Use pathIsSymbolicLink instead" #-}
+isSymbolicLink :: FilePath -> IO Bool
+isSymbolicLink = pathIsSymbolicLink
+
 #ifdef mingw32_HOST_OS
 -- | Open the handle of an existing file or directory.
 openFileHandle :: String -> Win32.AccessMode -> IO Win32.HANDLE
diff --git a/changelog.md b/changelog.md
index e2a370b..823f225 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,11 +1,15 @@
 Changelog for the [`directory`][1] package
 ==========================================
 
-## 1.3.0.0 (November 2016)
+## 1.3.0.0 (December 2016)
 
   * Drop trailing slashes in `canonicalizePath`
     ([#63](https://github.com/haskell/directory/issues/63))
 
+  * Rename `isSymbolicLink` to `pathIsSymbolicLink`.  The old name will remain
+    available but may be removed in the next major release.
+    ([#52](https://github.com/haskell/directory/issues/52))
+
 ## 1.2.7.1 (November 2016)
 
   * Don't abort `removePathForcibly` if files or directories go missing.
diff --git a/directory.cabal b/directory.cabal
index 06c4d0d..ef9903c 100644
--- a/directory.cabal
+++ b/directory.cabal
@@ -95,8 +95,8 @@ test-suite test
         GetFileSize
         GetHomeDirectory001
         GetPermissions001
-        IsSymbolicLink
         MakeAbsolute
+        PathIsSymbolicLink
         RemoveDirectoryRecursive001
         RemovePathForcibly
         RenameDirectory
diff --git a/tests/Main.hs b/tests/Main.hs
index 6fb34dc..1e17b68 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -17,8 +17,8 @@ import qualified GetDirContents002
 import qualified GetFileSize
 import qualified GetHomeDirectory001
 import qualified GetPermissions001
-import qualified IsSymbolicLink
 import qualified MakeAbsolute
+import qualified PathIsSymbolicLink
 import qualified RemoveDirectoryRecursive001
 import qualified RemovePathForcibly
 import qualified RenameDirectory
@@ -47,8 +47,8 @@ main = T.testMain $ \ _t -> do
   T.isolatedRun _t "GetFileSize" GetFileSize.main
   T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main
   T.isolatedRun _t "GetPermissions001" GetPermissions001.main
-  T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main
   T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main
+  T.isolatedRun _t "PathIsSymbolicLink" PathIsSymbolicLink.main
   T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main
   T.isolatedRun _t "RemovePathForcibly" RemovePathForcibly.main
   T.isolatedRun _t "RenameDirectory" RenameDirectory.main
diff --git a/tests/IsSymbolicLink.hs b/tests/PathIsSymbolicLink.hs
similarity index 87%
rename from tests/IsSymbolicLink.hs
rename to tests/PathIsSymbolicLink.hs
index 3f39e55..ea4fd16 100644
--- a/tests/IsSymbolicLink.hs
+++ b/tests/PathIsSymbolicLink.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE CPP #-}
-module IsSymbolicLink where
+module PathIsSymbolicLink where
 #include "util.inl"
 import System.Directory
 import Control.Monad (when)
@@ -20,4 +20,4 @@ main _t = do
       else ioError e
 #endif
   when success $
-    T(expect) () =<< isSymbolicLink "y"
+    T(expect) () =<< pathIsSymbolicLink "y"
diff --git a/tests/Util.hs b/tests/Util.hs
index 8ec2040..453854a 100644
--- a/tests/Util.hs
+++ b/tests/Util.hs
@@ -17,7 +17,7 @@ import Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar)
 import Control.Exception (SomeException, bracket_, mask, onException, try)
 import Control.Monad (Monad(..), unless, when)
 import System.Directory (createDirectoryIfMissing, doesDirectoryExist,
-                         isSymbolicLink, listDirectory, makeAbsolute,
+                         pathIsSymbolicLink, listDirectory, makeAbsolute,
                          removePathForcibly, withCurrentDirectory)
 import System.Environment (getArgs)
 import System.Exit (exitFailure)
@@ -137,7 +137,7 @@ preprocessPathRecursive f path = do
   dirExists <- doesDirectoryExist path
   if dirExists
     then do
-      isLink <- isSymbolicLink path
+      isLink <- pathIsSymbolicLink path
       f path
       when (not isLink) $ do
         names <- listDirectory path



More information about the ghc-commits mailing list