[net7.0] Use Environment.SpecialFolder.UserProfile, not SpecialFolder.Personal.

Context: dotnet/runtime#68610
Context: https://github.com/xamarin/xamarin-android-tools/commit/0be567a9

In Mono and .NET prior to .NET 8, the
[`System.Environment.SpecialFolder`][0]`.Personal` enum value would refer to
`$HOME` on Unix platforms.

This will be changing in .NET 8, such that
`Environment.SpecialFolder.Personal` will instead refer to
`$XDG_DOCUMENTS_DIR` (if set) or `$HOME/Documents`.  This is for "semantic
compatibility" with .NET on Windows.

Replace usage of `Environment.SpecialFolder.Personal` with
`Environment.SpecialFolder.UserProfile`, so that our code continues to work as
expected under .NET 8.

[0]: https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=net-6.0

Backport of ##107.
This commit is contained in:
Rolf Bjarne Kvinge 2022-11-08 18:33:42 +01:00
Родитель 0717ac3c24
Коммит fc05c313e7
3 изменённых файлов: 4 добавлений и 4 удалений

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

@ -142,7 +142,7 @@ namespace Xamarin.MacDev
static AppleSdkSettings ()
{
var home = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
var home = Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
var preferences = Path.Combine (home, "Library", "Preferences", "Xamarin");
if (!Directory.Exists (preferences))

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

@ -59,7 +59,7 @@ namespace Xamarin.MacDev
if (Environment.OSVersion.Platform == PlatformID.MacOSX
|| Environment.OSVersion.Platform == PlatformID.Unix)
{
string personal = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string personal = Environment.GetFolderPath(Environment.SpecialFolder.UserPersonal);
ProfileDirectory = Path.Combine(personal, "Library", "MobileDevice", "Provisioning Profiles");
}
else

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

@ -1,4 +1,4 @@
//
//
// MobileProvisionIndex.cs
//
// Author: Jeffrey Stedfast <jeff@xamarin.com>
@ -199,7 +199,7 @@ namespace Xamarin.MacDev
if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
{
xamarinFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library", "Xamarin");
xamarinFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Xamarin");
}
else
{