Replace inline INVALID_HANDLE_VALUE checks with check-invalid-handle calls

On error find-first-file will now throw a windows-error instance instead of
a string.
fix-linux
Alexander Iljin 2016-05-24 20:33:19 +03:00 committed by John Benediktsson
parent 38ab7289b5
commit 1e61dbfd2a
2 changed files with 2 additions and 4 deletions

View File

@ -48,8 +48,7 @@ M: windows delete-directory ( path -- )
RemoveDirectory win32-error=0/f ;
: find-first-file ( path WIN32_FIND_DATA -- WIN32_FIND_DATA HANDLE )
[ nip ] [ FindFirstFile ] 2bi
[ INVALID_HANDLE_VALUE = [ win32-error-string throw ] when ] keep ;
[ nip ] [ FindFirstFile ] 2bi check-invalid-handle ;
: find-next-file ( HANDLE WIN32_FIND_DATA -- WIN32_FIND_DATA/f )
[ nip ] [ FindNextFile ] 2bi 0 = [

View File

@ -42,8 +42,7 @@ TUPLE: windows-file-info < file-info-tuple attributes ;
: find-first-file-stat ( path -- WIN32_FIND_DATA )
WIN32_FIND_DATA <struct> [
FindFirstFile
[ INVALID_HANDLE_VALUE = [ win32-error ] when ] keep
FindFirstFile check-invalid-handle
FindClose win32-error=0/f
] keep ;