Browse Source

Merge pull request #828 from SuperJMN/master

Environment.CurrentDirectory is modified after showing a Dialog
pull/833/head
Steven Kirk 9 years ago
committed by GitHub
parent
commit
3aa9c32f91
  1. 7
      src/Windows/Avalonia.Win32/SystemDialogImpl.cs

7
src/Windows/Avalonia.Win32/SystemDialogImpl.cs

@ -88,9 +88,16 @@ namespace Avalonia.Win32
var pofn = &ofn;
// We should save the current directory to restore it later.
var currentDirectory = Environment.CurrentDirectory;
var res = dialog is OpenFileDialog
? UnmanagedMethods.GetOpenFileName(new IntPtr(pofn))
: UnmanagedMethods.GetSaveFileName(new IntPtr(pofn));
// Restore the old current directory, since GetOpenFileName and GetSaveFileName change it after they're called
Environment.CurrentDirectory = currentDirectory;
if (!res)
return null;
if (dialog?.Filters.Count > 0)

Loading…
Cancel
Save