From f530692362ed0350a5f5ea17e89b970cae1c4e24 Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Wed, 25 May 2016 10:25:53 +0300 Subject: [PATCH] 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. --- basis/io/files/info/windows/windows.factor | 2 +- basis/io/files/windows/windows.factor | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/basis/io/files/info/windows/windows.factor b/basis/io/files/info/windows/windows.factor index 0bcdb86a3c..fc12f52345 100755 --- a/basis/io/files/info/windows/windows.factor +++ b/basis/io/files/info/windows/windows.factor @@ -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 ; diff --git a/basis/io/files/windows/windows.factor b/basis/io/files/windows/windows.factor index 9a7915eadf..344e7595fb 100755 --- a/basis/io/files/windows/windows.factor +++ b/basis/io/files/windows/windows.factor @@ -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 ; - : maybe-create-file ( path -- win32-file ? ) ! return true if file was just created flags{ GENERIC_READ GENERIC_WRITE }