I am working on an application for Windows 7, and run some routine directory creation code:
string dirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MyDir");
if (!Directory.Exists(dirPath))
Directory.CreateDirectory(dirPath);
The problem is that the Directory.Exists line returns true, when I can't see the directory through command line and Windows Explorer. This isn't an issue when working with Windows XP. Is there something going on with Windows 7 that I'm not aware of?
EDIT: Added Path.Combine
Please understand that Windows Vista and Windows 7 use virtualization to protect such folders, so you need to check if myDir is in virtualstore,
C:\Users(user name)\AppData\Local\VirtualStore\ProgramData
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With