Updated touch to also create the file if missing

This commit is contained in:
Gabriel Gonzalez 2015-01-18 20:52:06 -08:00
parent 57054122d3
commit 5e2d77f65f

View file

@ -276,7 +276,11 @@ testdir = Filesystem.isDirectory
Creates the file if it does not exist
-}
touch :: FilePath -> IO ()
touch file = touchFile (Filesystem.encodeString file)
touch file = do
exists <- testfile file
if exists
then touchFile (Filesystem.encodeString file)
else sh (fileOut file empty)
#endif
{-| Create a temporary directory underneath the given directory