io.unix.files: New version of touch-file

db4
Eduardo Cavazos 2008-05-09 16:24:58 -05:00
parent 2b7bd1a8e1
commit e0ddb3d0eb
1 changed files with 4 additions and 3 deletions

View File

@ -45,9 +45,10 @@ M: unix (file-appender) ( path -- stream )
M: unix touch-file ( path -- ) M: unix touch-file ( path -- )
normalize-path normalize-path
touch-mode file-mode open dup exists?
dup 0 < [ err_no EEXIST = [ err_no io-error ] unless ] when [ f utime ]
close ; [ touch-mode file-mode open close ]
if ;
M: unix move-file ( from to -- ) M: unix move-file ( from to -- )
[ normalize-path ] bi@ rename io-error ; [ normalize-path ] bi@ rename io-error ;