From b58688f87d3b6b1c5a6c1612000b01434ca7b806 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 19 Oct 2011 02:51:36 -0700 Subject: [PATCH] Add throw-win32-error, use it in (delete-file) --- basis/io/directories/windows/windows.factor | 2 +- basis/windows/errors/errors.factor | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/basis/io/directories/windows/windows.factor b/basis/io/directories/windows/windows.factor index 3d1bfddde5..b02f8731f5 100644 --- a/basis/io/directories/windows/windows.factor +++ b/basis/io/directories/windows/windows.factor @@ -28,7 +28,7 @@ ERROR: file-delete-failed path error ; : (delete-file) ( path -- ) dup DeleteFile 0 = [ GetLastError ERROR_ACCESS_DENIED = - [ delete-read-only-file ] [ win32-error ] if + [ delete-read-only-file ] [ throw-win32-error ] if ] [ drop ] if ; M: windows delete-file ( path -- ) diff --git a/basis/windows/errors/errors.factor b/basis/windows/errors/errors.factor index b90b766883..e13c245f1e 100755 --- a/basis/windows/errors/errors.factor +++ b/basis/windows/errors/errors.factor @@ -740,9 +740,12 @@ ERROR: windows-error n string ; ] [ dup n>win32-error-string windows-error ] if ; + +: throw-win32-error ( -- * ) + win32-error-string throw ; : check-invalid-handle ( handle -- handle ) - dup INVALID_HANDLE_VALUE = [ win32-error-string throw ] when ; + dup INVALID_HANDLE_VALUE = [ throw-win32-error ] when ; CONSTANT: expected-io-errors ${ @@ -759,7 +762,7 @@ CONSTANT: expected-io-errors dup expected-io-error? [ drop ] [ - win32-error-string throw + throw-win32-error ] if ; : io-error ( return-value -- ) -- 2.34.1