Re: Testing Write Access on Windows

new topic     » goto parent     » topic index » view thread      » older message » newer message
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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu