io.files.windows: use open-file to implement maybe-create-file

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:46:30 +03:00 committed by John Benediktsson
parent f530692362
commit d243e00f54
1 changed files with 1 additions and 5 deletions

View File

@ -248,11 +248,7 @@ M: windows init-stdio
: maybe-create-file ( path -- win32-file ? )
! return true if file was just created
flags{ GENERIC_READ GENERIC_WRITE }
share-mode
f
OPEN_ALWAYS
0 CreateFile-flags
f CreateFileW dup win32-error=0/f <win32-file>
OPEN_ALWAYS 0 open-file
GetLastError ERROR_ALREADY_EXISTS = not ;
: set-file-pointer ( handle length method -- )