io.files.windows: replace open-existing with open-r/w

This fixes error throwing in case of CreateFile failure, and calls
add-completion for the file handle on success.
char-rename
Alexander Iljin 2016-05-25 10:25:53 +03:00 committed by John Benediktsson
parent ae1c7b7a54
commit f530692362
2 changed files with 1 additions and 9 deletions

View File

@ -232,7 +232,7 @@ M: windows file-systems ( -- array )
! timestamp order: creation access write
[
[
normalize-path open-existing &dispose handle>>
normalize-path open-r/w &dispose handle>>
] 3dip (set-file-times)
] with-destructors ;

View File

@ -245,14 +245,6 @@ M: windows init-stdio
: (open-append) ( path -- win32-file )
GENERIC_WRITE OPEN_ALWAYS 0 open-file ;
: open-existing ( path -- win32-file )
flags{ GENERIC_READ GENERIC_WRITE }
share-mode
f
OPEN_EXISTING
FILE_FLAG_BACKUP_SEMANTICS
f CreateFileW dup win32-error=0/f <win32-file> ;
: maybe-create-file ( path -- win32-file ? )
! return true if file was just created
flags{ GENERIC_READ GENERIC_WRITE }