Use Environment.SpecialFolder.UserProfile instead of Personal

Mono and .NET, before .NET 8, would resolve the
System.Environment.SpecialFolder.Personal enum value to the $HOME
directory. In .NET 8 this is changing. The Personal folder will now
refer to $XDG_DOCUMENTS_DIR if set or $HOME/Documents otherwise.

Replace all uses of Environment.SpecialFolder.Personal with
Environment.SpecialFolder.UserProfile so the code behaves as it did
before. UserProfile still maps to $HOME

dotnet/runtime#68610
This commit is contained in:
Matt Ward 2022-09-20 09:44:21 +01:00
Родитель f653d1b053
Коммит 647c988599
4 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -531,7 +531,7 @@ namespace Mono.Addins.Gui
if (lastFolder != null)
dlg.SetCurrentFolder (lastFolder);
else
dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
dlg.SelectMultiple = true;
Gtk.FileFilter f = new Gtk.FileFilter ();

Просмотреть файл

@ -95,7 +95,7 @@ namespace Mono.Addins.Gui
dlg.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
dlg.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok);
dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
if (dlg.Run () == (int) ResponseType.Ok) {
pathEntry.Text = dlg.Filename;
}

Просмотреть файл

@ -584,7 +584,7 @@ namespace Mono.Addins.GuiGtk3
if (lastFolder != null)
dlg.SetCurrentFolder (lastFolder);
else
dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
dlg.SelectMultiple = true;
Gtk.FileFilter f = new Gtk.FileFilter ();

Просмотреть файл

@ -113,7 +113,7 @@ namespace Mono.Addins.GuiGtk3
dlg.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
dlg.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok);
dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
if (dlg.Run () == (int) ResponseType.Ok) {
pathEntry.Text = dlg.Filename;
}