Current directory is not so current
I stumbled upon something weird today. In C# you have System.Environment.CurrentDirectory which - just as the name says - returns the current directory for the executing application.
I don't know why I used it in my application but it was a fault as I found out today. I used this to load a file from a folder beside the application. Since I didn't changed the CurrentDirectory anywhere in the code my self and always work with absolute paths I didn't see any problem with this. And on my developing machine which runs Windows 7 everything worked fine.
However on Windows XP this variable seems to be changed by the SaveFileDialog and the OpenFileDialog. Took me some time to figure this out and I still haven't found an explanation why this happens. Well I switched to Application.StartupPath (yes I know there is a path for the assembly itself) and everything works under XP and 7.
Dec 21st 2010, 18:43 by Sylence.