Don't ask for Linux

This commit is contained in:
George Fleming 2016-04-26 15:53:51 -07:00
parent a8f4fb8a07
commit 967634f732
2 changed files with 24 additions and 19 deletions

View file

@ -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

View file

@ -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);