mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 03:07:56 +01:00
[PT Run] [Program] Fix FileSystemWatcher Crash (#14649)
This commit is contained in:
committed by
GitHub
parent
974bf4708c
commit
ec11abbc52
@@ -1,10 +1,13 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Storage
|
||||
{
|
||||
@@ -33,7 +36,18 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory),
|
||||
};
|
||||
return paths;
|
||||
|
||||
var invalidPaths = new List<string>();
|
||||
foreach (var path in paths)
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Log.Warn($"Directory {path} does not exist and will be ignored", typeof(Win32ProgramFileSystemWatchers));
|
||||
invalidPaths.Add(path);
|
||||
}
|
||||
}
|
||||
|
||||
return paths.Except(invalidPaths).ToArray();
|
||||
}
|
||||
|
||||
// Initializes the FileSystemWatchers
|
||||
|
||||
Reference in New Issue
Block a user