From e0ddb3d0eb9b58ffcdf9756edb19e29eef7798bb Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 9 May 2008 16:24:58 -0500 Subject: [PATCH] io.unix.files: New version of touch-file --- extra/io/unix/files/files.factor | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/io/unix/files/files.factor b/extra/io/unix/files/files.factor index a09ebb46c9..b361974a20 100755 --- a/extra/io/unix/files/files.factor +++ b/extra/io/unix/files/files.factor @@ -45,9 +45,10 @@ M: unix (file-appender) ( path -- stream ) M: unix touch-file ( path -- ) normalize-path - touch-mode file-mode open - dup 0 < [ err_no EEXIST = [ err_no io-error ] unless ] when - close ; + dup exists? + [ f utime ] + [ touch-mode file-mode open close ] + if ; M: unix move-file ( from to -- ) [ normalize-path ] bi@ rename io-error ;