[.net] .NET System.Environment.CurrentDirectory Bug?
I doubt it's a bug, but I wanted to share this with other .NET programmers. Upon closing an OpenFileDialog control, the System.Environment.CurrentDirectory setting changes to the file I specified. This might be somewhat useful under certain circumstances, but it's particularly damning in my project.
1. Is this documented?
2 Should I be using another environment variable rather than resetting this variable upon closing the OpenFileDialog?
This is normal behavior. It would be best to store the current directory seperately if you require it to be remembered.
I don't believe this is a bug. After all, how do you think the dialog "remembers" what directory was opened last in the dialog itself?
As for using a different variable, what value are you wanting to get? For instance, you can use either Application.StartUp path or Assembly.GetExecutingAssembly().Location. These are *not* the same value. It depends on what directory you want to get.
As for using a different variable, what value are you wanting to get? For instance, you can use either Application.StartUp path or Assembly.GetExecutingAssembly().Location. These are *not* the same value. It depends on what directory you want to get.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement