commit
89d9e5e569
1 changed files with 9 additions and 0 deletions
|
@ -132,6 +132,7 @@ module Turtle.Prelude (
|
||||||
, rmtree
|
, rmtree
|
||||||
, testfile
|
, testfile
|
||||||
, testdir
|
, testdir
|
||||||
|
, testpath
|
||||||
, date
|
, date
|
||||||
, datefile
|
, datefile
|
||||||
, touch
|
, touch
|
||||||
|
@ -680,6 +681,14 @@ testfile path = liftIO (Filesystem.isFile path)
|
||||||
testdir :: MonadIO io => FilePath -> io Bool
|
testdir :: MonadIO io => FilePath -> io Bool
|
||||||
testdir path = liftIO (Filesystem.isDirectory path)
|
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
|
{-| Touch a file, updating the access and modification times to the current time
|
||||||
|
|
||||||
Creates an empty file if it does not exist
|
Creates an empty file if it does not exist
|
||||||
|
|
Loading…
Reference in a new issue