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.
locals-and-roots
Alexander Iljin 2016-05-24 17:06:31 +03:00 committed by Doug Coleman
parent 2264638a61
commit 043c6984b9
1 changed files with 4 additions and 1 deletions

View File

@ -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? ;