Add throw-win32-error, use it in (delete-file)
parent
feeea08023
commit
b58688f87d
|
@ -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 -- )
|
||||
|
|
|
@ -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 -- )
|
||||
|
|
Loading…
Reference in New Issue