]> gitweb.factorcode.org Git - factor.git/commitdiff
Replace inline INVALID_HANDLE_VALUE checks with check-invalid-handle calls
authorAlexander Iljin <ajsoft@yandex.ru>
Tue, 24 May 2016 17:33:19 +0000 (20:33 +0300)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 6 Jan 2020 21:18:33 +0000 (13:18 -0800)
On error find-first-file will now throw a windows-error instance instead of
a string.

basis/io/directories/windows/windows.factor
basis/io/files/info/windows/windows.factor

index ec7615677582415c24de59e4d1c3a1ca77b6631d..76cc8f33f0a18460162d2f7750204bd2bc420fe8 100644 (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 = [
index 71f8e06f695203f415f5c2c9ccca3d87dc388a23..90d17a03d5df390de3e99cfe3ac3979fb8837a69 100644 (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 ;