mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Don't ask for Linux
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user