mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 03:07:56 +01:00
[PTRun][Program] Avoid looping on folder cycles (#13685)
This commit is contained in:
@@ -625,9 +625,20 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
var folderQueue = new Queue<string>();
|
||||
folderQueue.Enqueue(directory);
|
||||
|
||||
// Keep track of already visited directories to avoid cycles.
|
||||
var alreadyVisited = new HashSet<string>();
|
||||
|
||||
do
|
||||
{
|
||||
var currentDirectory = folderQueue.Dequeue();
|
||||
|
||||
if (alreadyVisited.Contains(currentDirectory))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
alreadyVisited.Add(currentDirectory);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var suffix in suffixes)
|
||||
|
||||
Reference in New Issue
Block a user