Skip to content

Commit

Permalink
Merge pull request #92 from evanrelf/master
Browse files Browse the repository at this point in the history
Add missing `directory` functions and types
  • Loading branch information
snoyberg authored Feb 9, 2022
2 parents 9304166 + b9e3b33 commit 39ed892
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
8 changes: 8 additions & 0 deletions unliftio/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for unliftio

## 0.2.21.0

* Add `UnliftIO.Directory.createDirectoryLink`
* Add `UnliftIO.Directory.removeDirectoryLink`
* Add `UnliftIO.Directory.getSymbolicLinkTarget`
* Add `UnliftIO.Directory.XdgDirectoryList`
* Add `UnliftIO.Directory.getXdgDirectoryList`

## 0.2.20.1

* Fix time-osx.c for aarch64 mac [#91](https://github.com/fpco/unliftio/pull/91)
Expand Down
2 changes: 1 addition & 1 deletion unliftio/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: unliftio
version: 0.2.20.1
version: 0.2.21.0
synopsis: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)
description: Please see the documentation and README at <https://www.stackage.org/package/unliftio>
homepage: https://github.com/fpco/unliftio/tree/master/unliftio#readme
Expand Down
40 changes: 40 additions & 0 deletions unliftio/src/UnliftIO/Directory.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module UnliftIO.Directory (
, createDirectoryIfMissing
#if MIN_VERSION_directory(1,3,1)
, createFileLink
, createDirectoryLink
, removeDirectoryLink
, getSymbolicLinkTarget
#endif
, removeDirectory
, removeDirectoryRecursive
Expand All @@ -33,6 +36,10 @@ module UnliftIO.Directory (
#if MIN_VERSION_directory(1,2,3)
, XdgDirectory(..)
, getXdgDirectory
#endif
#if MIN_VERSION_directory(1,3,2)
, XdgDirectoryList(..)
, getXdgDirectoryList
#endif
, getAppUserDataDirectory
, getUserDocumentsDirectory
Expand Down Expand Up @@ -122,6 +129,9 @@ import System.Directory
( Permissions
#if MIN_VERSION_directory(1,2,3)
, XdgDirectory(..)
#endif
#if MIN_VERSION_directory(1,3,2)
, XdgDirectoryList(..)
#endif
, emptyPermissions
#if MIN_VERSION_directory(1,2,4)
Expand Down Expand Up @@ -164,6 +174,27 @@ createFileLink
-> m ()
createFileLink targetPath linkPath =
liftIO (D.createFileLink targetPath linkPath)

-- | Lifted 'D.createDirectoryLink'.
--
-- @since 0.2.21.0
createDirectoryLink :: MonadIO m => FilePath -> FilePath -> m ()
createDirectoryLink targetPath linkPath =
liftIO (D.createDirectoryLink targetPath linkPath)

-- | Lifted 'D.removeDirectoryLink'.
--
-- @since 0.2.21.0
removeDirectoryLink :: MonadIO m => FilePath -> m ()
removeDirectoryLink linkPath =
liftIO (D.removeDirectoryLink linkPath)

-- | Lifted 'D.getSymbolicLinkTarget'.
--
-- @since 0.2.21.0
getSymbolicLinkTarget :: MonadIO m => FilePath -> m FilePath
getSymbolicLinkTarget linkPath =
liftIO (D.getSymbolicLinkTarget linkPath)
#endif

-- | Lifted 'D.removeDirectory'.
Expand Down Expand Up @@ -252,6 +283,15 @@ getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath
getXdgDirectory xdgDir suffix = liftIO (D.getXdgDirectory xdgDir suffix)
#endif

#if MIN_VERSION_directory(1,3,2)
-- | Lifted 'D.getXdgDirectoryList'.
--
-- @since 0.2.21.0
getXdgDirectoryList :: MonadIO m => XdgDirectoryList -> m [FilePath]
getXdgDirectoryList xdgDirectoryList =
liftIO (D.getXdgDirectoryList xdgDirectoryList)
#endif

-- | Lifted 'D.getAppUserDataDirectory'.
--
-- @since 0.2.6.0
Expand Down

0 comments on commit 39ed892

Please sign in to comment.