The Daily WTF
The saying goes that debugging is like solving a murder mystery, where you are both the victim and the killer. This, of course, is a bit inaccurate, since we rarely are the only programmer working on a project.
Cole Tobin brings us a small mystery in C# today, though in this case, the mystery is- how does this even work?
string localDir = “null”; string filePath; if (save_to_Temp) { dir = Path.GetDirectoryName(engineeringDataPushPath); } else { #if PRODUCTION dir = @”S:DocumentscalibrationCalibration Certs” + modelNumber + “”; #else dir = @”calibration cert” + “”; #endif } if (localDir != null) dir = localDir;
The middle of this code is a bit of static about trying to guess where a file should get stored, with bonuses for a hard-coded reference to a mapped network drive when running in production, which I’m sure will never cause problems. Even better, they take advantage of
To read the full article click on the 'post' link at the top.