views:

72

answers:

1

So far in development, my application has been storing its databases in the app base directory. When it is deployed this will be in program files so I cant keep them there!

The obvoius places are:

Environment.SpecialFolder.LocalApplicationData
Environment.SpecialFolder.ApplicationData

One problem is that data downloads can be run from sceduled tasks so I would have to ensure tasks were run under the same user.

The major issue is that after a couple of years, these database files could total 5 to 10GB, so I feel like I should give the user an option after install to choose the database location. I'd have to ensure that it was writable and not a network location.

What solutions have others come up with?

A: 

About checking the write access to a directory: So far I have found no better way than to create a file in the directory and immediately delete it. If you encounter an error during these steps, you have insufficient privilegs. (Just remember to first check if there is enough free space on the drive).

I once tried to solve this programmatically by going through the access control lists, but then i encountered a dir where I had write priviliges, but not the right to list the ACLs...

You can check if a given drive is a network share by using the DriveType property of the System.IO.DriveInfo object. As for handling UNC pathes, I have yet to find a better way than (myPath.Substring(0,2) == @"\\")

Treb