Add testpath
. Fixes #111
This commit is contained in:
parent
0c7fc6bb86
commit
5529ccb435
1 changed files with 9 additions and 0 deletions
|
@ -132,6 +132,7 @@ module Turtle.Prelude (
|
|||
, rmtree
|
||||
, testfile
|
||||
, testdir
|
||||
, testpath
|
||||
, date
|
||||
, datefile
|
||||
, touch
|
||||
|
@ -680,6 +681,14 @@ testfile path = liftIO (Filesystem.isFile path)
|
|||
testdir :: MonadIO io => FilePath -> io Bool
|
||||
testdir path = liftIO (Filesystem.isDirectory path)
|
||||
|
||||
-- | Check if a path exists
|
||||
testpath :: MonadIO io => FilePath -> io Bool
|
||||
testpath path = do
|
||||
exists <- testfile path
|
||||
if exists
|
||||
then return exists
|
||||
else testdir path
|
||||
|
||||
{-| Touch a file, updating the access and modification times to the current time
|
||||
|
||||
Creates an empty file if it does not exist
|
||||
|
|
Loading…
Reference in a new issue