path-io 0.3.0 → 0.3.1
raw patch · 3 files changed
+36/−5 lines, 3 files
Files
- CHANGELOG.md +12/−0
- Path/IO.hs +23/−4
- path-io.cabal +1/−1
CHANGELOG.md view
@@ -1,3 +1,15 @@+## Path IO 0.3.1++* Introduced synonym for `forgivingAbsence'` —+ `ignoringAbsence`. `forgivingAbsence'` is deprecated now, but it's still+ there.++* Added a handy shortcut `ensureDir` that is defined as+ `ensureDir = createDirIfMissing True`.++* Made `getHomeDir` and `getTempDir` more robust when they are influenced by+ values of environment variables.+ ## Path IO 0.3.0 * Added `forgivingAbsence`, `resolveFile`, and `resolveDir` functions, so
Path/IO.hs view
@@ -20,6 +20,7 @@ ( -- * Actions on directories createDir , createDirIfMissing+ , ensureDir , removeDir , removeDirRecur , renameDir@@ -64,6 +65,7 @@ , doesDirExist , isLocationOccupied , forgivingAbsence+ , ignoringAbsence , forgivingAbsence' -- * Permissions , D.Permissions@@ -157,6 +159,14 @@ -> m () createDirIfMissing p = liftD (D.createDirectoryIfMissing p) +-- | Ensure that directory exists creating it and its parent directories if+-- necessary. This is just a handy shortcut:+--+-- > ensureDir = createDirIfMissing True++ensureDir :: MonadIO m => Path b Dir -> m ()+ensureDir = createDirIfMissing True+ -- | @'removeDir' dir@ removes an existing directory @dir@. The -- implementation may specify additional constraints which must be satisfied -- before a directory can be removed (e.g. the directory has to be empty, or@@ -456,7 +466,7 @@ -- cannot be found. getHomeDir :: (MonadIO m, MonadThrow m) => m (Path Abs Dir)-getHomeDir = liftIO D.getHomeDirectory >>= parseAbsDir+getHomeDir = liftIO D.getHomeDirectory >>= resolveDir' -- | Obtain the path to a special directory for storing user-specific -- application data (traditional Unix location).@@ -533,10 +543,12 @@ -- * 'UnsupportedOperation' -- The operating system has no notion of temporary directory. ----- The function doesn't verify whether the path exists.+-- * 'isDoesNotExistError'+-- The temporary directory for the current user does not exist, or+-- cannot be found. getTempDir :: (MonadIO m, MonadThrow m) => m (Path Abs Dir)-getTempDir = liftIO D.getTemporaryDirectory >>= parseAbsDir+getTempDir = liftIO D.getTemporaryDirectory >>= resolveDir' ---------------------------------------------------------------------------- -- Path transformation@@ -959,8 +971,15 @@ -- | The same as 'forgivingAbsence', but ignores result. +ignoringAbsence :: (MonadIO m, MonadCatch m) => m a -> m ()+ignoringAbsence = liftM (const ()) . forgivingAbsence++-- | A synonym for 'ignoringAbsence'.++{-# DEPRECATED forgivingAbsence' "Use 'ignoringAbsence' instead." #-}+ forgivingAbsence' :: (MonadIO m, MonadCatch m) => m a -> m ()-forgivingAbsence' = liftM (const ()) . forgivingAbsence+forgivingAbsence' = ignoringAbsence ---------------------------------------------------------------------------- -- Permissions
path-io.cabal view
@@ -31,7 +31,7 @@ -- POSSIBILITY OF SUCH DAMAGE. name: path-io-version: 0.3.0+version: 0.3.1 cabal-version: >= 1.10 license: BSD3 license-file: LICENSE.md