Environment.GetFolderPath(...CommonApplicationData) is still returning c:\Docs&Set on Vista
- by blak3r
As i understand it, you're supposed to use Environment.GetFolderPath method so you have OS independent code...
WinXP uses C:\Docs and Settings\
Vista uses C:\ProgramData and c:\Users
I'm using the code below on a vista computer and it's returning a c:\documents and settings directory instead of c:\ProgramData like it should... Any ideas?
string commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
try
{
File.CreateText( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\mycompany\\uid");
log.Debug("Created file successfully");
}
catch (Exception ex)
{
log.Error("Unable to create the uid file: ", ex);
}
EDIT: I was mistaken... See my answer below. Please vote to close this post as it's no longer relevent.