From 2249afcd0ab8f06e0cff9e031a9b97eea2ca9818 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 14 Jul 2016 14:51:59 -0700 Subject: [PATCH] Remove Platform.HasUNCSupport query --- .../CoreCLR/CorePsPlatform.cs | 7 ------- src/System.Management.Automation/engine/Utils.cs | 8 ++++---- .../namespaces/FileSystemProvider.cs | 14 +++++--------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 4a9bda08ca..7082e29c11 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -217,13 +217,6 @@ namespace System.Management.Automation } - // Linux has no support for UNC, just mounts in a single rooted hierarchy - // the UNC equivalent of a "network drive" aka mount would be the mount itself - internal static bool HasUNCSupport() - { - return IsWindows; - } - // Linux uses .net to query file attributes internal static bool UseDotNetToQueryFileAttributes() { diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 878908be5e..7c5cdbe3ac 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -1129,12 +1129,12 @@ namespace System.Management.Automation internal static bool PathIsUnc(string path) { - if (!Platform.HasUNCSupport()) - { - return false; - } +#if LINUX + return false; +#else Uri uri; return !string.IsNullOrEmpty(path) && Uri.TryCreate(path, UriKind.Absolute, out uri) && uri.IsUnc; +#endif } internal class NativeMethods diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 6af52e291c..60664ee731 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -685,15 +685,11 @@ namespace Microsoft.PowerShell.Commands /// internal static string GetUNCForNetworkDrive(string driveName) { - // Porting note: on systems that do not support UNC paths, the UNC equivalent is the path itself - if (Platform.HasUNCSupport()) - { - return WinGetUNCForNetworkDrive(driveName); - } - else - { - return driveName; - } +#if LINUX + return driveName; +#else + return WinGetUNCForNetworkDrive(driveName); +#endif } private static string WinGetUNCForNetworkDrive(string driveName)