@@ -130,15 +130,26 @@ pathToLazyByteString = BSL.fromStrict . pathToByteString
130
130
pathToByteString :: Path b t -> BS. ByteString
131
131
pathToByteString = T. encodeUtf8 . pathToText
132
132
133
+ -- | Convert to a 'T.Text' type.
133
134
pathToText :: Path b t -> T. Text
134
135
pathToText = T. pack . toFilePath
135
136
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.
136
146
tryGetModificationTime :: MonadIO m => Path Abs File -> m (Either () UTCTime )
137
147
tryGetModificationTime =
138
148
liftIO . tryJust (guard . isDoesNotExistError) . getModificationTime
139
149
140
150
-- | '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.
142
153
forgivingResolveDir ::
143
154
MonadIO m
144
155
=> Path Abs Dir
@@ -156,7 +167,8 @@ forgivingResolveDir b p = liftIO $
156
167
)
157
168
158
169
-- | '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.
160
172
forgivingResolveFile ::
161
173
MonadIO m
162
174
=> Path Abs Dir
@@ -174,7 +186,8 @@ forgivingResolveFile b p = liftIO $
174
186
)
175
187
176
188
-- | '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.
178
191
forgivingResolveFile' ::
179
192
MonadIO m
180
193
=> FilePath
0 commit comments