fix issue when someone had penumbra folder at the root of their drive
This commit is contained in:
@@ -91,7 +91,17 @@ public sealed class PeriodicFileScanner : DisposableMediatorSubscriberBase
|
|||||||
await Task.Delay(250, token).ConfigureAwait(false);
|
await Task.Delay(250, token).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread scanThread = new(() => _performanceCollector.LogPerformance(this, "PeriodicFileScan", () => PeriodicFileScan(isForcedFromExternal, token)))
|
Thread scanThread = new(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_performanceCollector.LogPerformance(this, "PeriodicFileScan", () => PeriodicFileScan(isForcedFromExternal, token));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError(ex, "Error during Periodic File Scan");
|
||||||
|
}
|
||||||
|
})
|
||||||
{
|
{
|
||||||
Priority = ThreadPriority.Lowest,
|
Priority = ThreadPriority.Lowest,
|
||||||
IsBackground = true
|
IsBackground = true
|
||||||
@@ -208,12 +218,19 @@ public sealed class PeriodicFileScanner : DisposableMediatorSubscriberBase
|
|||||||
Dictionary<string, string[]> penumbraFiles = new(StringComparer.Ordinal);
|
Dictionary<string, string[]> penumbraFiles = new(StringComparer.Ordinal);
|
||||||
foreach (var folder in Directory.EnumerateDirectories(penumbraDir!))
|
foreach (var folder in Directory.EnumerateDirectories(penumbraDir!))
|
||||||
{
|
{
|
||||||
penumbraFiles[folder] = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories)
|
try
|
||||||
.AsParallel()
|
{
|
||||||
.Where(f => ext.Any(e => f.EndsWith(e, StringComparison.OrdinalIgnoreCase))
|
penumbraFiles[folder] = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories)
|
||||||
&& !f.Contains(@"\bg\", StringComparison.OrdinalIgnoreCase)
|
.AsParallel()
|
||||||
&& !f.Contains(@"\bgcommon\", StringComparison.OrdinalIgnoreCase)
|
.Where(f => ext.Any(e => f.EndsWith(e, StringComparison.OrdinalIgnoreCase))
|
||||||
&& !f.Contains(@"\ui\", StringComparison.OrdinalIgnoreCase)).ToArray();
|
&& !f.Contains(@"\bg\", StringComparison.OrdinalIgnoreCase)
|
||||||
|
&& !f.Contains(@"\bgcommon\", StringComparison.OrdinalIgnoreCase)
|
||||||
|
&& !f.Contains(@"\ui\", StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogWarning(ex, "Could not enumerate path {path}", folder);
|
||||||
|
}
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
if (ct.IsCancellationRequested) return;
|
if (ct.IsCancellationRequested) return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user