Jump to content
  • Advertisement
Sign in to follow this  
Geronimo2000

[.net] .NET System.Environment.CurrentDirectory Bug?

This topic is 5054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
This is normal behavior. It would be best to store the current directory seperately if you require it to be remembered.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Yes, I see it's not a bug at all... When I last set the ResetCurrentDirectory property, I erroneously believed it was related to the dialog's InitialDirectory property, which of course it is not.

My apologies for the stupid post. This is obviously NOT a bug.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!