[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

How to check if a directory is writable (without being virtualized.

Oolis Kraprin

7/8/2008 2:55:00 PM

Hi, I have an application that lets the user choose the storage
directory for the data, and copies any existing data into it.
I had assumed that trying to copy into a non-writable directory like
Windows, would cause an exception, but it silently copys everything
into the virtual store. The program then cannot find the data. (Why
does virtualization only happen on writing? Surely if windows is smart
enough to map a directory to the virtual store when writing it should
also check the store when trying to open the file too!)

Anyway, I would have preferred the exception to be raised. But even
better would be a function that could tell me if the directory is
truely writable (so I could prevent the user from selecting that
directory). I looked in Directory and DirectoryInfo classes but didn't
find anything. Trying to create a file inside the directory succeeds,
but is stored in virtual store.

Whats the standard way of doing this check? I would prefer a solution
that also works on XP as well as vista.