Version 7 of file readable

Updated 2010-02-17 13:35:44 by LVwikignome

file readable name

Returns 1 if file name is readable by the current user, 0 otherwise.

On NTFS volumes, this doesn't currently take account of the more complex Windows user/group stuff, so can return the wrong value. Code contributions using 'GetSecurityInfo()' much appreciated.

RS 2007-02-16 Quick workaround:

 proc file'readable name {
    set rc [catch {open $name} fp]
    if {$rc==0} {close $fp}
    expr {$rc==0}
 }

jdc 23-oct-2007

After upgrading from Tcl 8.4.9 to 8.4.16, I experienced problems with file readable for file on a SMB mount. file readable always returns 0, unless the others have read privilege on the file. Tcl 8.5b1 has the same behavior.


See also: