From 967634f732af01ebec8e6718fd5ed7af3f7eadca Mon Sep 17 00:00:00 2001 From: George Fleming Date: Tue, 26 Apr 2016 15:53:51 -0700 Subject: [PATCH] Don't ask for Linux --- .../commands/management/Navigation.cs | 26 ++++++++++++------- .../namespaces/FileSystemProvider.cs | 17 +++++------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs index d2ba941ee1..c986672d1e 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs @@ -3562,20 +3562,28 @@ namespace Microsoft.PowerShell.Commands } bool shouldRecurse = Recurse; - if (!Recurse && hasChildren) + System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(providerPath); + if (Platform.IsLinux && di != null && (di.Attributes & System.IO.FileAttributes.ReparsePoint) != 0) { - // Get the localized prompt string + shouldRecurse = false; + } + else + { + if (!Recurse && hasChildren) + { + // Get the localized prompt string - string prompt = StringUtil.Format(NavigationResources.RemoveItemWithChildren,resolvedPath.Path); + string prompt = StringUtil.Format(NavigationResources.RemoveItemWithChildren,resolvedPath.Path); - // Confirm the user wants to remove all children and the item even if - // they did not specify -recurse + // Confirm the user wants to remove all children and the item even if + // they did not specify -recurse - if (!ShouldContinue (prompt, null, ref yesToAll, ref noToAll)) - { - continue; + if (!ShouldContinue (prompt, null, ref yesToAll, ref noToAll)) + { + continue; + } + shouldRecurse = true; } - shouldRecurse = true; } // Now do the delete diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index b867160347..d94bc854ca 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -2848,20 +2848,17 @@ namespace Microsoft.PowerShell.Commands bool continueRemoval = true; - if (Platform.IsWindows || (directory.Attributes & FileAttributes.ReparsePoint) == 0) + // We only want to confirm the removal if this is the root of the + // tree being removed or the recurse flag is specified. + if (rootOfRemoval || recurse) { - // We only want to confirm the removal if this is the root of the - // tree being removed or the recurse flag is specified. - if (rootOfRemoval || recurse) - { - // Confirm the user wants to remove the directory - string action = FileSystemProviderStrings.RemoveItemActionDirectory; - continueRemoval = ShouldProcess(directory.FullName, action); - } + // Confirm the user wants to remove the directory + string action = FileSystemProviderStrings.RemoveItemActionDirectory; + continueRemoval = ShouldProcess(directory.FullName, action); } //if this is a reparse point and force is not specified then warn user but dont remove the directory. - if (((directory.Attributes & FileAttributes.ReparsePoint) != 0) && !Force) + if (Platform.IsWindows && ((directory.Attributes & FileAttributes.ReparsePoint) != 0) && !Force) { String error = StringUtil.Format(FileSystemProviderStrings.DirectoryReparsePoint, directory.FullName); Exception e = new IOException(error);