Adapt corert to Environment moving from corefx
authorStephen Toub <stoub@microsoft.com>
Wed, 30 Jan 2019 17:18:01 +0000 (12:18 -0500)
committerJan Kotas <jkotas@microsoft.com>
Thu, 31 Jan 2019 17:33:51 +0000 (09:33 -0800)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/c44cedb3c30f04c34693c14838891d7f87398e28

src/libraries/System.Private.CoreLib/src/System/Environment.WinRT.cs

index 72d66c4..a8e3dbc 100644 (file)
@@ -3,14 +3,22 @@
 // See the LICENSE file in the project root for more information.
 
 using System.IO;
+using Internal.Runtime.Augments;
 
 namespace System
 {
     public static partial class Environment
     {
         public static string UserName => "Windows User";
+
         public static string UserDomainName => "Windows Domain";
-        private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) =>
-            WinRTFolderPaths.GetFolderPath(folder, option);
+
+        private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option)
+        {
+            WinRTInteropCallbacks callbacks = WinRTInterop.UnsafeCallbacks;
+            return callbacks != null && callbacks.IsAppxModel() ?
+                callbacks.GetFolderPath(folder, option) :
+                null;
+        }
     }
 }