Version 4 of file readable

Updated 2007-02-16 10:31:18 by suchenwi

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}
 }

See also:


Tcl syntax help - Category Command - Category Introspection - Category File