packages feed

directory 1.2.4.0 → 1.2.5.0

raw patch · 13 files changed

+76/−74 lines, 13 filesdep ~basedep ~timePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, time

API changes (from Hackage documentation)

- System.Directory: instance Bounded XdgDirectory
- System.Directory: instance Enum DirectoryType
- System.Directory: instance Enum XdgDirectory
- System.Directory: instance Eq DirectoryType
- System.Directory: instance Eq Permissions
- System.Directory: instance Eq XdgDirectory
- System.Directory: instance Ord DirectoryType
- System.Directory: instance Ord Permissions
- System.Directory: instance Ord XdgDirectory
- System.Directory: instance Read DirectoryType
- System.Directory: instance Read Permissions
- System.Directory: instance Read XdgDirectory
- System.Directory: instance Show DirectoryType
- System.Directory: instance Show Permissions
- System.Directory: instance Show XdgDirectory
+ System.Directory: instance GHC.Classes.Eq System.Directory.DirectoryType
+ System.Directory: instance GHC.Classes.Eq System.Directory.Permissions
+ System.Directory: instance GHC.Classes.Eq System.Directory.XdgDirectory
+ System.Directory: instance GHC.Classes.Ord System.Directory.DirectoryType
+ System.Directory: instance GHC.Classes.Ord System.Directory.Permissions
+ System.Directory: instance GHC.Classes.Ord System.Directory.XdgDirectory
+ System.Directory: instance GHC.Enum.Bounded System.Directory.XdgDirectory
+ System.Directory: instance GHC.Enum.Enum System.Directory.DirectoryType
+ System.Directory: instance GHC.Enum.Enum System.Directory.XdgDirectory
+ System.Directory: instance GHC.Read.Read System.Directory.DirectoryType
+ System.Directory: instance GHC.Read.Read System.Directory.Permissions
+ System.Directory: instance GHC.Read.Read System.Directory.XdgDirectory
+ System.Directory: instance GHC.Show.Show System.Directory.DirectoryType
+ System.Directory: instance GHC.Show.Show System.Directory.Permissions
+ System.Directory: instance GHC.Show.Show System.Directory.XdgDirectory
+ System.Directory: listDirectory :: FilePath -> IO [FilePath]

Files

System/Directory.hs view
@@ -29,6 +29,7 @@     , removeDirectory     , removeDirectoryRecursive     , renameDirectory+    , listDirectory     , getDirectoryContents     -- ** Current working directory     , getCurrentDirectory@@ -176,8 +177,8 @@ A directory contains a series of entries, each of which is a named reference to a file system object (file, directory etc.).  Some entries may be hidden, inaccessible, or have some administrative-function (e.g. `.' or `..' under POSIX-<http://www.opengroup.org/onlinepubs/009695399/>), but in+function (e.g. @.@ or @..@ under+<http://www.opengroup.org/onlinepubs/009695399 POSIX>), but in this standard all such entries are considered to form part of the directory contents. Entries in sub-directories are not, however, considered to form part of the directory contents.@@ -571,8 +572,8 @@ removeContentsRecursive :: FilePath -> IO () removeContentsRecursive path =   (`ioeSetLocation` "removeContentsRecursive") `modifyIOError` do-    cont <- getDirectoryContents path-    mapM_ removePathRecursive [path </> x | x <- cont, x /= "." && x /= ".."]+    cont <- listDirectory path+    mapM_ removePathRecursive [path </> x | x <- cont]     removeDirectory path  #if __GLASGOW_HASKELL__@@ -963,37 +964,8 @@         else findFilesWith f ds fileName  #ifdef __GLASGOW_HASKELL__-{- |@'getDirectoryContents' dir@ returns a list of /all/ entries-in /dir/.--The operation may fail with:--* 'HardwareFault'-A physical I\/O error has occurred.-@[EIO]@--* 'InvalidArgument'-The operand is not a valid directory name.-@[ENAMETOOLONG, ELOOP]@--* 'isDoesNotExistError' \/ 'NoSuchThing'-The directory does not exist.-@[ENOENT, ENOTDIR]@--* 'isPermissionError' \/ 'PermissionDenied'-The process has insufficient privileges to perform the operation.-@[EACCES]@--* 'ResourceExhausted'-Insufficient resources are available to perform the operation.-@[EMFILE, ENFILE]@--* 'InappropriateType'-The path refers to an existing non-directory object.-@[ENOTDIR]@---}-+-- | Similar to 'listDirectory', but always includes the special entries (@.@+-- and @..@).  (This applies to Windows as well.) getDirectoryContents :: FilePath -> IO [FilePath] getDirectoryContents path =   modifyIOError ((`ioeSetFileName` path) .@@ -1029,6 +1001,42 @@           else return (filename:acc)                  -- no need to reverse, ordering is undefined #endif /* mingw32 */++-- | @'listDirectory' dir@ returns a list of /all/ entries in /dir/ without+-- the special entries (@.@ and @..@).+--+-- The operation may fail with:+--+-- * 'HardwareFault'+--   A physical I\/O error has occurred.+--   @[EIO]@+--+-- * 'InvalidArgument'+--   The operand is not a valid directory name.+--   @[ENAMETOOLONG, ELOOP]@+--+-- * 'isDoesNotExistError' \/ 'NoSuchThing'+--   The directory does not exist.+--   @[ENOENT, ENOTDIR]@+--+-- * 'isPermissionError' \/ 'PermissionDenied'+--   The process has insufficient privileges to perform the operation.+--   @[EACCES]@+--+-- * 'ResourceExhausted'+--   Insufficient resources are available to perform the operation.+--   @[EMFILE, ENFILE]@+--+-- * 'InappropriateType'+--   The path refers to an existing non-directory object.+--   @[ENOTDIR]@+--+-- @since 1.2.5.0+--+listDirectory :: FilePath -> IO [FilePath]+listDirectory path =+  (filter f) <$> (getDirectoryContents path)+  where f filename = filename /= "." && filename /= ".."  #endif /* __GLASGOW_HASKELL__ */ 
System/Directory/Internal/C_utimensat.hsc view
@@ -30,7 +30,7 @@       nsec <- #{peek struct timespec, tv_nsec} p       return (CTimeSpec sec nsec) -c_AT_FDCWD :: Integral a => a+c_AT_FDCWD :: CInt c_AT_FDCWD = (#const AT_FDCWD)  utimeOmit :: CTimeSpec
changelog.md view
@@ -1,6 +1,15 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.5.0 (December 2015)++  * Add `listDirectory`, which is similar to `getDirectoryContents`+    but omits `.` and `..`+    ([#36](https://github.com/haskell/directory/pull/36))++  * Remove support for `--with-cc=` in `configure`; use the `CC=` flag instead+    ([ghc:D1608](https://phabricator.haskell.org/D1608))+ ## 1.2.4.0 (September 2015)    * Work around lack of `#const_str` when cross-compiling@@ -27,6 +36,8 @@     ([#13](https://github.com/haskell/directory/issues/13))    * Implement `getAccessTime` and `setAccessTime`++  * Set the filename in IO errors from the file time functions    * Fix `canonicalizePath` so that it always returns a reasonable result even     if the path is inaccessible and will not throw exceptions unless the
configure view
@@ -676,7 +676,6 @@ ac_user_opts=' enable_option_checking with_gcc-with_cc with_compiler '       ac_precious_vars='build_alias@@ -2111,18 +2110,12 @@     esac } -# inherit the C compiler from Cabal but allow it to be overridden by --with-cc-# because Cabal puts its own flags at the end+# Legacy support for setting the C compiler with Cabal<1.24+# Newer versions use Autoconf's native `CC=...` facility  # Check whether --with-gcc was given. if test "${with_gcc+set}" = set; then :   withval=$with_gcc; set_with_gcc-fi---# Check whether --with-cc was given.-if test "${with_cc+set}" = set; then :-  withval=$with_cc; CC=$withval fi  # avoid warnings when run via Cabal
configure.ac view
@@ -16,14 +16,11 @@     esac } -# inherit the C compiler from Cabal but allow it to be overridden by --with-cc-# because Cabal puts its own flags at the end+# Legacy support for setting the C compiler with Cabal<1.24+# Newer versions use Autoconf's native `CC=...` facility AC_ARG_WITH([gcc],             [C compiler],             [set_with_gcc])-AC_ARG_WITH([cc],-            [C compiler],-            [CC=$withval]) # avoid warnings when run via Cabal AC_ARG_WITH([compiler],             [GHC compiler],
directory.cabal view
@@ -1,5 +1,5 @@ name:           directory-version:        1.2.4.0+version:        1.2.5.0 -- NOTE: Don't forget to update ./changelog.md license:        BSD3 license-file:   LICENSE@@ -59,7 +59,7 @@         HsDirectory.h      build-depends:-        base     >= 4.5 && < 4.9,+        base     >= 4.5 && < 4.10,         time     >= 1.4 && < 1.6,         filepath >= 1.3 && < 1.5     if os(windows)
tests/CopyFile001.hs view
@@ -3,19 +3,17 @@ #include "util.inl" import System.Directory import Data.List (sort)-import Data.Monoid ((<>)) import System.FilePath ((</>))  main :: TestEnv -> IO () main _t = do   createDirectory dir   writeFile (dir </> from) contents-  T(expectEq) () (specials <> [from]) . sort =<< getDirectoryContents dir+  T(expectEq) () [from] . sort =<< listDirectory dir   copyFile (dir </> from) (dir </> to)-  T(expectEq) () (specials <> [from, to]) . sort =<< getDirectoryContents dir+  T(expectEq) () [from, to] . sort =<< listDirectory dir   T(expectEq) () contents =<< readFile (dir </> to)   where-    specials = [".", ".."]     contents = "This is the data\n"     from     = "source"     to       = "target"
tests/CopyFile002.hs view
@@ -3,19 +3,17 @@ #include "util.inl" import System.Directory import Data.List (sort)-import Data.Monoid ((<>))  main :: TestEnv -> IO () main _t = do   -- Similar to CopyFile001 but moves a file in the current directory   -- (Bug #1652 on GHC Trac)   writeFile from contents-  T(expectEq) () (specials <> [from]) . sort =<< getDirectoryContents "."+  T(expectEq) () [from] . sort =<< listDirectory "."   copyFile from to-  T(expectEq) () (specials <> [from, to]) . sort =<< getDirectoryContents "."+  T(expectEq) () [from, to] . sort =<< listDirectory "."   T(expectEq) () contents =<< readFile to   where-    specials = [".", ".."]     contents = "This is the data\n"     from     = "source"     to       = "target"
tests/CreateDirectoryIfMissing001.hs view
@@ -6,13 +6,10 @@ import qualified Control.Exception as E import Control.Monad (replicateM_) import Data.Monoid ((<>))-import System.FilePath ((</>), addTrailingPathSeparator)-import System.IO.Error(isAlreadyExistsError, isDoesNotExistError,-                       isPermissionError)-#ifndef mingw32_HOST_OS import GHC.IO.Exception (IOErrorType(InappropriateType))-import System.IO.Error(ioeGetErrorType)-#endif+import System.FilePath ((</>), addTrailingPathSeparator)+import System.IO.Error (ioeGetErrorType, isAlreadyExistsError,+                        isDoesNotExistError, isPermissionError)  main :: TestEnv -> IO () main _t = do
tests/GetDirContents001.hs view
@@ -11,10 +11,12 @@ main _t = do   createDirectory dir   T(expectEq) () specials . sort =<< getDirectoryContents dir+  T(expectEq) () [] . sort =<< listDirectory dir   names <- for [1 .. 100 :: Int] $ \ i -> do     let name = 'f' : show i     writeFile (dir </> name) ""     return name   T(expectEq) () (sort (specials <> names)) . sort =<< getDirectoryContents dir+  T(expectEq) () (sort names) . sort =<< listDirectory dir   where dir      = "dir"         specials = [".", ".."]
tests/TestUtils.hs view
@@ -41,10 +41,10 @@     dirExists <- doesDirectoryExist source     if dirExists       then do-        contents <- getDirectoryContents source+        contents <- listDirectory source         createDirectory dest         mapM_ (uncurry copyPathRecursive)-          [(source </> x, dest </> x) | x <- contents, x /= "." && x /= ".."]+          [(source </> x, dest </> x) | x <- contents]       else copyFile source dest  modifyPermissions :: FilePath -> (Permissions -> Permissions) -> IO ()
tests/Util.hs view
@@ -16,7 +16,7 @@ import Control.Exception (SomeException, bracket_, catch,                           mask, onException, try) import Control.Monad (Monad(..), unless, when)-import System.Directory (createDirectory, makeAbsolute,+import System.Directory (createDirectoryIfMissing, makeAbsolute,                          removeDirectoryRecursive, withCurrentDirectory) import System.Environment (getArgs) import System.Exit (exitFailure)@@ -134,7 +134,7 @@ withNewDirectory :: Bool -> FilePath -> IO a -> IO a withNewDirectory keep dir action = do   dir' <- makeAbsolute dir-  bracket_ (createDirectory dir') (cleanup dir') action+  bracket_ (createDirectoryIfMissing True dir') (cleanup dir') action   where cleanup dir' | keep      = return ()                      | otherwise = removeDirectoryRecursive dir' 
tests/WithCurrentDirectory.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} module WithCurrentDirectory where #include "util.inl"-import Data.Monoid ((<>)) import Data.List (sort) import System.Directory import System.FilePath ((</>))@@ -10,17 +9,16 @@ main _t = do   createDirectory dir   -- Make sure we're starting empty-  T(expectEq) () specials . sort =<< getDirectoryContents dir+  T(expectEq) () [] . sort =<< listDirectory dir   cwd <- getCurrentDirectory   withCurrentDirectory dir (writeFile testfile contents)   -- Are we still in original directory?   T(expectEq) () cwd =<< getCurrentDirectory   -- Did the test file get created?-  T(expectEq) () (specials <> [testfile]) . sort =<< getDirectoryContents dir+  T(expectEq) () [testfile] . sort =<< listDirectory dir   -- Does the file contain what we expected to write?   T(expectEq) () contents =<< readFile (dir </> testfile)   where     testfile = "testfile"     contents = "some data\n"     dir = "dir"-    specials = [".", ".."]