diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 5f780cef1f..8f10fa2bdc 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -217,12 +217,6 @@ namespace System.Management.Automation } - // non-windows does not support removing drives - internal static bool SupportsRemoveDrive() - { - return IsWindows; - } - // Platform methods prefixed NonWindows are: // - non-windows by the definition of the IsWindows method above // - here, because porting to Linux and other operating systems diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 4b4c024c70..d5e370e6cd 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -607,15 +607,11 @@ namespace Microsoft.PowerShell.Commands /// protected override PSDriveInfo RemoveDrive(PSDriveInfo drive) { - // if removing the drive is not supported, just return the drive - if (Platform.SupportsRemoveDrive()) - { - return WinRemoveDrive(drive); - } - else - { - return drive; - } +#if LINUX + return drive; +#else + return WinRemoveDrive(drive); +#endif } private PSDriveInfo WinRemoveDrive(PSDriveInfo drive)