Add throw-win32-error, use it in (delete-file)

db4
Doug Coleman 2011-10-19 02:51:36 -07:00
parent feeea08023
commit b58688f87d
2 changed files with 6 additions and 3 deletions

View File

@ -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 -- )

View File

@ -741,8 +741,11 @@ 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 -- )