Version 3 of file writable

Updated 2005-12-15 17:51:27

file writable name

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


RS just noticed that from Windows 2000 over network boundaries, it may report 1 even for directories where I positively may not write. A hacky workaround seems to be:

 set dummyname $name.[clock seconds] ;# not to clobber an existing one
 if { [catch {file open $dummyname w]} fp] } {
   # not writable
 } else {
   close $fp
   file delete $dummyname
 }

Vince adds --- 'NativeAccess' in tclWinFile.c needs updating to deal with Windows user/permission-related information (whatever that is -- anyone have any pointers?).


See also:


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