From 527f30a0139ac2b7ca73bb401786102d1ba9c4f4 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 14 Jul 2016 14:36:41 -0700 Subject: [PATCH] Remove Platform.HasSingleRootFilesystem query --- .../CoreCLR/CorePsPlatform.cs | 8 +------- .../namespaces/FileSystemProvider.cs | 4 +++- .../namespaces/LocationGlobber.cs | 9 ++++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 6edfbaa90c..c4edc350c0 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -217,18 +217,12 @@ namespace System.Management.Automation } - // Linux has a single rooted file system - internal static bool HasSingleRootFilesystem() - { - return !IsWindows; - } - // Linux has no notion of file shares. It has mount points // instead, which are subdirectories of its single-root // filesystem. internal static bool HasFileShares() { - return !HasSingleRootFilesystem(); + return IsWindows(); } // Linux has no support for UNC, just mounts in a single rooted hierarchy diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 50a84e98b1..6af52e291c 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -947,12 +947,14 @@ namespace Microsoft.PowerShell.Commands root = newDrive.RootDirectory.FullName; } +#if LINUX // Porting notes: On platforms with single root filesystems, only // add the filesystem with the root "/" to the initial drive list, // otherwise path handling will not work correctly because there // is no : available to separate the filesystems from each other - if (Platform.HasSingleRootFilesystem() && root != StringLiterals.DefaultPathSeparatorString) + if (root != StringLiterals.DefaultPathSeparatorString) continue; +#endif // Porting notes: On non-windows platforms .net can report two // drives with the same root, make sure to only add one of those diff --git a/src/System.Management.Automation/namespaces/LocationGlobber.cs b/src/System.Management.Automation/namespaces/LocationGlobber.cs index 313e9e0e6c..c150dd7179 100644 --- a/src/System.Management.Automation/namespaces/LocationGlobber.cs +++ b/src/System.Management.Automation/namespaces/LocationGlobber.cs @@ -1589,9 +1589,12 @@ namespace System.Management.Automation /// internal static bool IsSingleFileSystemAbsolutePath(string path) { - return Platform.HasSingleRootFilesystem() && - (path.StartsWith(StringLiterals.DefaultPathSeparatorString, StringComparison.Ordinal) || - path.StartsWith(StringLiterals.AlternatePathSeparatorString, StringComparison.Ordinal)); +#if LINUX + return path.StartsWith(StringLiterals.DefaultPathSeparatorString, StringComparison.Ordinal) + || path.StartsWith(StringLiterals.AlternatePathSeparatorString, StringComparison.Ordinal); +#else + return false; +#endif } // IsSingleFileSystemAbsolutePath ///