Revert "Delete throw-win32-error, replace with win32-error calls"

This reverts commit e1be081ec9.
fix-linux
Doug Coleman 2020-01-03 13:04:01 -06:00
parent c308d794db
commit d9f1093cf8
3 changed files with 11 additions and 4 deletions

View File

@ -31,7 +31,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

@ -117,7 +117,7 @@ M: windows init-io ( -- )
: handle>file-size ( handle -- n/f )
(handle>file-size) [
GetLastError ERROR_INVALID_FUNCTION =
[ f ] [ win32-error ] if
[ f ] [ throw-win32-error ] if
] unless* ;
ERROR: seek-before-start n ;
@ -400,7 +400,7 @@ M: windows home
0
[ FindFirstStream ] keepd
over INVALID_HANDLE_VALUE = [
2drop win32-error
2drop throw-win32-error
] [
1vector swap file-streams-rest
] if ;

View File

@ -740,6 +740,9 @@ 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 ] when ;
@ -755,7 +758,11 @@ CONSTANT: expected-io-errors
expected-io-errors member? ;
: expected-io-error ( error-code -- )
expected-io-error? [ win32-error ] unless ;
dup expected-io-error? [
drop
] [
throw-win32-error
] if ;
: io-error ( return-value -- )
{ 0 f } member? [ GetLastError expected-io-error ] when ;