mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix FileNotFoundException
This commit is contained in:
1 parent
967634f732
commit
1b1858cf09
1 file changed
+26
-19
@@ -3562,29 +3562,36 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
|
||||
bool shouldRecurse = Recurse;
|
||||
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(providerPath);
|
||||
if (Platform.IsLinux && di != null && (di.Attributes & System.IO.FileAttributes.ReparsePoint) != 0)
|
||||
bool linuxLink = false;
|
||||
try
|
||||
{
|
||||
shouldRecurse = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
if (!ShouldContinue (prompt, null, ref yesToAll, ref noToAll))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
shouldRecurse = true;
|
||||
shouldRecurse = false;
|
||||
linuxLink = true;
|
||||
}
|
||||
}
|
||||
catch (System.IO.FileNotFoundException)
|
||||
{
|
||||
// not a directory
|
||||
}
|
||||
|
||||
if (!linuxLink && !Recurse && hasChildren)
|
||||
{
|
||||
// Get the localized prompt string
|
||||
|
||||
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
|
||||
|
||||
if (!ShouldContinue (prompt, null, ref yesToAll, ref noToAll))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
shouldRecurse = true;
|
||||
}
|
||||
|
||||
// Now do the delete
|
||||
// This calls the internal method since it is more efficient
|
||||
|
||||
Reference in new issue
Block a user