When I use some System.IO methods, and “accidentally” put extra slashes (\) in the path variables, nothing special seems to happen. No errors or warnings, and the code works as if just the right amount of slashes were present.
Example:
Directory.CreateDirectory(@"C:\Users\Public\Documents\\test");
File.Copy(@"C:\Users\Public\\Documents\test.txt", @"C:\Users\\Public\Documents\test\test.txt", true);
So I’m wondering, is it potentially dangerous if the code above had extra slashes sometimes, or would it not matter one iota under any circumstances?
Windows is quite resilient to this, haven’t noticed a problem yet.
Take a look at the snippet in this thread. Note the value of the _ACP_INCLUDE environment variable. You have to scroll to the right to see:
Afaik, a lot of machines that have VS2008 have this bad path, mine certainly does. Nevertheless, it certainly can trip up your own code when you parse path strings.