Windows 7 and Directory.Exists ???
-
I have the following lines of code (2.0 framework) that worked in Win XP, but doesn't work with Windows 7: if (!Directory.Exists(@"c:\Program Files\Newsham\PigtrakDesktop\RAPI")) { Directory.CreateDirectory(@"c:\Program Files\Newsham\PigtrakDesktop\RAPI"); } Here's the weird part: If I try to navigate to c:\Program Files\Newsham\PigtrakDesktop using the Windows 7 explorer, the RAPI directory is NOT there. However, in my code, if tell it to list the files in the same directory, there ARE FILES THERE! This is really killing me. Any thoughts?
-
I have the following lines of code (2.0 framework) that worked in Win XP, but doesn't work with Windows 7: if (!Directory.Exists(@"c:\Program Files\Newsham\PigtrakDesktop\RAPI")) { Directory.CreateDirectory(@"c:\Program Files\Newsham\PigtrakDesktop\RAPI"); } Here's the weird part: If I try to navigate to c:\Program Files\Newsham\PigtrakDesktop using the Windows 7 explorer, the RAPI directory is NOT there. However, in my code, if tell it to list the files in the same directory, there ARE FILES THERE! This is really killing me. Any thoughts?
I can't explain WHY the **** this is like this, but I found my files. They are located at: C:\Users\pbrower\AppData\Local\VirtualStore\Program Files\Newsham\PigtrakDesktop What the hell?
-
I can't explain WHY the **** this is like this, but I found my files. They are located at: C:\Users\pbrower\AppData\Local\VirtualStore\Program Files\Newsham\PigtrakDesktop What the hell?
-
I can't explain WHY the **** this is like this, but I found my files. They are located at: C:\Users\pbrower\AppData\Local\VirtualStore\Program Files\Newsham\PigtrakDesktop What the hell?
"C:\Program Files" is not writable for standard users (just as it was since Win2000 and earlier). Starting with Vista, the default user account is a standard user; getting admin rights only when you explicitly run an app with them (UAC). To allow old programs to continue to run, Windows will redirect writes to the "VirtualStore". This is done only with programs that are not marked as "UAC-compatible". So you have to do two things: 1) to avoid confusion due to file system virtualization; mark your program as UAC-compatible by embedding an UAC manifest. VS2008 should do this automatically (see "Application Manifest" in the project options); for VS2005 it's a little bit more complicated: http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx[^] 2) Don't write to Program Files.
-
"C:\Program Files" is not writable for standard users (just as it was since Win2000 and earlier). Starting with Vista, the default user account is a standard user; getting admin rights only when you explicitly run an app with them (UAC). To allow old programs to continue to run, Windows will redirect writes to the "VirtualStore". This is done only with programs that are not marked as "UAC-compatible". So you have to do two things: 1) to avoid confusion due to file system virtualization; mark your program as UAC-compatible by embedding an UAC manifest. VS2008 should do this automatically (see "Application Manifest" in the project options); for VS2005 it's a little bit more complicated: http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx[^] 2) Don't write to Program Files.
More specifically, don't write anywhere but the AppData folder.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001