@@ -130,15 +130,26 @@ pathToLazyByteString = BSL.fromStrict . pathToByteString
130130pathToByteString :: Path b t -> BS. ByteString
131131pathToByteString = T. encodeUtf8 . pathToText
132132
133+ -- | Convert to a 'T.Text' type.
133134pathToText :: Path b t -> T. Text
134135pathToText = T. pack . toFilePath
135136
137+ -- | Attempt to get the time at which the given file was last modified. Yields
138+ -- `Left ()` if the file does not exist.
139+ --
140+ -- The operation may fail with 'System.IO.Error.isPermissionError' if the user
141+ -- is not permitted to read the modification time.
142+ --
143+ -- Caveat for POSIX systems: This function returns a timestamp with sub-second
144+ -- resolution only if this package is compiled against `unix-2.6.0.0` or later
145+ -- and the underlying filesystem supports them.
136146tryGetModificationTime :: MonadIO m => Path Abs File -> m (Either () UTCTime )
137147tryGetModificationTime =
138148 liftIO . tryJust (guard . isDoesNotExistError) . getModificationTime
139149
140150-- | 'Path.IO.resolveDir' (@path-io@ package) throws 'InvalidAbsDir' (@path@
141- -- package) if the directory does not exist; this function yields 'Nothing'.
151+ -- package) in certain circumstances; this function yields 'Nothing' in those
152+ -- circumstances.
142153forgivingResolveDir ::
143154 MonadIO m
144155 => Path Abs Dir
@@ -156,7 +167,8 @@ forgivingResolveDir b p = liftIO $
156167 )
157168
158169-- | 'Path.IO.resolveFile' (@path-io@ package) throws 'InvalidAbsFile' (@path@
159- -- package) if the file does not exist; this function yields 'Nothing'.
170+ -- package) in certain circumstances; this function yields 'Nothing' in those
171+ -- circumstances.
160172forgivingResolveFile ::
161173 MonadIO m
162174 => Path Abs Dir
@@ -174,7 +186,8 @@ forgivingResolveFile b p = liftIO $
174186 )
175187
176188-- | 'Path.IO.resolveFile'' (@path-io@ package) throws 'InvalidAbsFile' (@path@
177- -- package) if the file does not exist; this function yields 'Nothing'.
189+ -- package) in certain circumstances; this function yields 'Nothing' in those
190+ -- circumstances.
178191forgivingResolveFile' ::
179192 MonadIO m
180193 => FilePath
0 commit comments