Windows defines a number of directories for specific things. One of those directories is a directory that a well-behaved Windows application should use to store user-specific data (e.g. a list of recently open documents by this user, customization information etc.). Usually this is a hidden directory In .NET framework, Adding version number is a mistake. When user upgrades the application, he doesn't want to loose his settings and customizations. Another way to get this is to use
class Util
{
static public string GetUserDataPath()
{
string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
dir = System.IO.Path.Combine(dir, "MySoftware");
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
return dir;
}
}
|