From 043c6984b9d8e9c0a6590bf96d99a6d4aaa1fd45 Mon Sep 17 00:00:00 2001
From: Alexander Iljin <ajsoft@yandex.ru>
Date: Tue, 24 May 2016 17:06:31 +0300
Subject: [PATCH] io.files.info.windows: fix file-readable?

This fixes issue #1470. Now the method tries to open the file handle for
reading and returns t on success. This approach makes Windows check the
current user's permissions.
---
 basis/io/files/info/windows/windows.factor | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/basis/io/files/info/windows/windows.factor b/basis/io/files/info/windows/windows.factor
index cb82a295fe..37be7164d3 100755
--- a/basis/io/files/info/windows/windows.factor
+++ b/basis/io/files/info/windows/windows.factor
@@ -244,6 +244,9 @@ M: windows file-systems ( -- array )
 : set-file-write-time ( path timestamp -- )
     [ f f ] dip set-file-times ;
 
-M: windows file-readable? file-info >boolean ;
+M: windows file-readable?
+    normalize-path open-read-handle
+    dup [ CloseHandle win32-error=0/f ] when* >boolean ;
+
 M: windows file-writable? file-info attributes>> +read-only+ swap member? not ;
 M: windows file-executable? file-executable-type windows-executable? ;