From d4aaf6434fc67820739c226e622a533a898fcc7b Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 30 Jan 2019 16:22:27 -0500 Subject: [PATCH] Switch CoreLib over to using shared Environment from corefx (dotnet/coreclr#22106) This requires merging/adapting the implementation with EnvironmentAugments (which goes away completely), the shared files, what corert has, etc. Commit migrated from https://github.com/dotnet/coreclr/commit/91e1ffccc38fc87f6f496eb056396a1b775f08af --- .../System.Private.CoreLib/Resources/Strings.resx | 9 + .../System.Private.CoreLib.csproj | 5 +- .../Runtime/Augments/EnvironmentAugments.cs | 36 +- .../src/Microsoft/Win32/Win32Native.cs | 23 - .../System.Private.CoreLib/src/System/CLRConfig.cs | 3 +- .../src/System/Environment.CoreCLR.cs | 158 +++++ .../src/System/Environment.Windows.cs | 34 - .../src/System/Environment.cs | 708 --------------------- .../System.Private.CoreLib/src/System/Exception.cs | 19 +- .../Kernel32/Interop.ExpandEnvironmentStrings.cs | 4 +- .../Kernel32/Interop.GetEnvironmentVariable.cs | 23 + .../src/System.Private.CoreLib.Shared.projitems | 48 +- .../src/System/Environment.NoRegistry.cs | 21 + .../src/System/Environment.Unix.cs | 20 +- .../src/System/Environment.Variables.Windows.cs | 168 +++++ .../src/System/Environment.Win32.cs | 140 +++- .../src/System/Environment.Windows.cs | 26 +- .../src/System/Environment.cs | 157 +++-- 18 files changed, 692 insertions(+), 910 deletions(-) create mode 100644 src/coreclr/src/System.Private.CoreLib/src/System/Environment.CoreCLR.cs delete mode 100644 src/coreclr/src/System.Private.CoreLib/src/System/Environment.Windows.cs delete mode 100644 src/coreclr/src/System.Private.CoreLib/src/System/Environment.cs create mode 100644 src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs create mode 100644 src/libraries/System.Private.CoreLib/src/System/Environment.NoRegistry.cs create mode 100644 src/libraries/System.Private.CoreLib/src/System/Environment.Variables.Windows.cs diff --git a/src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx b/src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx index 98a3d9e..6800d8e 100644 --- a/src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx +++ b/src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx @@ -496,6 +496,9 @@ Object must be of type Double. + + Drive name must be a root directory (i.e. 'C:\') or a drive letter ('C'). + Type provided must be an Enum. @@ -2464,6 +2467,9 @@ A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted. + + Computer name could not be obtained. + Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. @@ -3190,6 +3196,9 @@ Precondition failed: {0} + + The home directory of the current user could not be determined. + Only single dimension arrays are supported here. diff --git a/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj index db83064..d8bde72 100644 --- a/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -160,7 +160,7 @@ - + @@ -371,7 +371,6 @@ -