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
parent
ae1c7b7a54
commit
f530692362
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in New Issue