directory 1.1.0.1 → 1.1.0.2
raw patch · 3 files changed
+46/−37 lines, 3 filesdep ~basedep ~filepathdep ~old-timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, filepath, old-time
API changes (from Hackage documentation)
Files
- System/Directory.hs +37/−28
- directory.cabal +4/−4
- include/HsDirectory.h +5/−5
System/Directory.hs view
@@ -1,5 +1,8 @@ {-# OPTIONS_GHC -w #-} -- XXX We get some warnings on Windows+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |@@ -20,13 +23,13 @@ -- $intro -- * Actions on directories- createDirectory -- :: FilePath -> IO ()+ createDirectory -- :: FilePath -> IO () #ifndef __NHC__ , createDirectoryIfMissing -- :: Bool -> FilePath -> IO () #endif- , removeDirectory -- :: FilePath -> IO ()+ , removeDirectory -- :: FilePath -> IO () , removeDirectoryRecursive -- :: FilePath -> IO ()- , renameDirectory -- :: FilePath -> FilePath -> IO ()+ , renameDirectory -- :: FilePath -> FilePath -> IO () , getDirectoryContents -- :: FilePath -> IO [FilePath] , getCurrentDirectory -- :: IO FilePath@@ -39,7 +42,7 @@ , getTemporaryDirectory -- * Actions on files- , removeFile -- :: FilePath -> IO ()+ , removeFile -- :: FilePath -> IO () , renameFile -- :: FilePath -> FilePath -> IO () , copyFile -- :: FilePath -> FilePath -> IO () @@ -48,7 +51,7 @@ , findExecutable -- * Existence tests- , doesFileExist -- :: FilePath -> IO Bool+ , doesFileExist -- :: FilePath -> IO Bool , doesDirectoryExist -- :: FilePath -> IO Bool -- * Permissions@@ -67,7 +70,7 @@ , setOwnerSearchable , getPermissions -- :: FilePath -> IO Permissions- , setPermissions -- :: FilePath -> Permissions -> IO ()+ , setPermissions -- :: FilePath -> Permissions -> IO () , copyPermissions -- * Timestamps@@ -107,9 +110,9 @@ #ifdef __GLASGOW_HASKELL__ #if __GLASGOW_HASKELL__ >= 611-import GHC.IO.Exception ( IOException(..), IOErrorType(..), ioException )+import GHC.IO.Exception ( IOException(..), IOErrorType(..), ioException ) #else-import GHC.IOBase ( IOException(..), IOErrorType(..), ioException )+import GHC.IOBase ( IOException(..), IOErrorType(..), ioException ) #endif #if __GLASGOW_HASKELL__ > 700@@ -125,6 +128,11 @@ import qualified System.Posix as Posix #endif +#if __GLASGOW_HASKELL__ < 703+getFileSystemEncoding :: IO TextEncoding+getFileSystemEncoding = return fileSystemEncoding+#endif+ #endif /* __GLASGOW_HASKELL__ */ {- $intro@@ -368,8 +376,8 @@ -- @dir@ if it doesn\'t exist. If the first argument is 'True' -- the function will also create all parent directories if they are missing. createDirectoryIfMissing :: Bool -- ^ Create its parents too?- -> FilePath -- ^ The path to the directory you want to make- -> IO ()+ -> FilePath -- ^ The path to the directory you want to make+ -> IO () createDirectoryIfMissing create_parents path0 | create_parents = createDirs (parents path0) | otherwise = createDirs (take 1 (parents path0))@@ -587,10 +595,10 @@ let is_dir = Posix.fileMode stat .&. Posix.directoryMode /= 0 #endif if (not is_dir)- then ioException (ioeSetErrorString+ then ioException (ioeSetErrorString (mkIOError InappropriateType "renameDirectory" Nothing (Just opath)) "not a directory")- else do+ else do #ifdef mingw32_HOST_OS Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING #else@@ -653,10 +661,10 @@ let is_dir = Posix.isDirectory stat #endif if is_dir- then ioException (ioeSetErrorString- (mkIOError InappropriateType "renameFile" Nothing (Just opath))- "is a directory")- else do+ then ioException (ioeSetErrorString+ (mkIOError InappropriateType "renameFile" Nothing (Just opath))+ "is a directory")+ else do #ifdef mingw32_HOST_OS Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING #else@@ -713,21 +721,22 @@ canonicalizePath :: FilePath -> IO FilePath canonicalizePath fpath = #if defined(mingw32_HOST_OS)- do path <- Win32.getFullPathName fpath+ do path <- Win32.getFullPathName fpath #else #if __GLASGOW_HASKELL__ > 700- GHC.withCString fileSystemEncoding fpath $ \pInPath ->- allocaBytes long_path_size $ \pOutPath ->- do throwErrnoPathIfNull "canonicalizePath" fpath $ c_realpath pInPath pOutPath- path <- GHC.peekCString fileSystemEncoding pOutPath+ do enc <- getFileSystemEncoding+ GHC.withCString enc fpath $ \pInPath ->+ allocaBytes long_path_size $ \pOutPath ->+ do throwErrnoPathIfNull "canonicalizePath" fpath $ c_realpath pInPath pOutPath+ path <- GHC.peekCString enc pOutPath #else withCString fpath $ \pInPath ->- allocaBytes long_path_size $ \pOutPath ->- do throwErrnoPathIfNull "canonicalizePath" fpath $ c_realpath pInPath pOutPath- path <- peekCString pOutPath+ allocaBytes long_path_size $ \pOutPath ->+ do throwErrnoPathIfNull "canonicalizePath" fpath $ c_realpath pInPath pOutPath+ path <- peekCString pOutPath #endif #endif- return (normalise path)+ return (normalise path) -- normalise does more stuff, like upper-casing the drive letter #if !defined(mingw32_HOST_OS)@@ -1004,7 +1013,7 @@ allocaBytes sizeof_stat $ \p -> withFilePath (fileNameEndClean name) $ \s -> do throwErrnoIfMinus1Retry_ loc (c_stat s p)- f p+ f p withFileOrSymlinkStatus :: String -> FilePath -> (Ptr CStat -> IO a) -> IO a withFileOrSymlinkStatus loc name f = do@@ -1012,7 +1021,7 @@ allocaBytes sizeof_stat $ \p -> withFilePath name $ \s -> do throwErrnoIfMinus1Retry_ loc (lstat s p)- f p+ f p modificationTime :: Ptr CStat -> IO ClockTime modificationTime stat = do@@ -1042,7 +1051,7 @@ long_path_size :: Int #else long_path_size :: Int-long_path_size = 2048 -- // guess?+long_path_size = 2048 -- // guess? #endif /* __GLASGOW_HASKELL__ */ {- | Returns the current user's home directory.
directory.cabal view
@@ -1,5 +1,5 @@ name: directory-version: 1.1.0.1+version: 1.1.0.2 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org@@ -32,9 +32,9 @@ extensions: CPP, ForeignFunctionInterface if impl(ghc >= 7.1) extensions: NondecreasingIndentation- build-depends: base >= 4.2 && < 4.5,- old-time >= 1.0 && < 1.1,- filepath >= 1.1 && < 1.3+ build-depends: base >= 4.2 && < 4.6,+ old-time >= 1.0 && < 1.2,+ filepath >= 1.1 && < 1.4 if !impl(nhc98) { if os(windows) { build-depends: Win32
include/HsDirectory.h view
@@ -57,7 +57,7 @@ * (PATH_MAX is not defined on systems with unlimited path length, * e.g. the Hurd). */-INLINE HsInt __hscore_long_path_size() {+INLINE HsInt __hscore_long_path_size(void) { #ifdef PATH_MAX return PATH_MAX; #else@@ -65,10 +65,10 @@ #endif } -INLINE mode_t __hscore_S_IRUSR() { return S_IRUSR; }-INLINE mode_t __hscore_S_IWUSR() { return S_IWUSR; }-INLINE mode_t __hscore_S_IXUSR() { return S_IXUSR; }-INLINE mode_t __hscore_S_IFDIR() { return S_IFDIR; }+INLINE mode_t __hscore_S_IRUSR(void) { return S_IRUSR; }+INLINE mode_t __hscore_S_IWUSR(void) { return S_IWUSR; }+INLINE mode_t __hscore_S_IXUSR(void) { return S_IXUSR; }+INLINE mode_t __hscore_S_IFDIR(void) { return S_IFDIR; } #endif /* __HSDIRECTORY_H__ */