tags:

views:

37

answers:

1

Hi,

I am using OpenFileDialog. But using it changes the Environment.CurrentDirectory. Using the RestoreDirectory property solves this issue, but I'm using external dlls that I can't control that don't use RestoreDirectory.

Is there a way to make it true as default? Or is there any other solution to this annoying problem?

Thanks.

+2  A: 

Saving the current path and restoring it after the dialog has been shown would do the trick imo:

var currentDir = Environment.CurrentDirectory;

// Show File open dialog etc ...

Environment.CurrentDirectory = currentDir;
MartinStettner