Re: Testing Write Access on Windows
- Posted by mattlewis (admin) Mar 01, 2013
- 1269 views
euphoric said...
What's a good way to test for write access to a directory on Windows? Is there a flag available somewhere, or do I need to attempt to write a file and gauge results based on that?
Use dir():
include std/filesys.e sequence c = dir( `C:\` ) for i = 1 to length( c ) do if find( 'd', c[i][D_ATTRIBUTES] ) then printf(1, "%s: %s\n", { c[i][D_NAME], c[i][D_ATTRIBUTES] }) end if end for
If you have 'r' in D_ATTRIBUTES then it's read only.
Matt