Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

Use ExePath instead of ExeDir in CheckForExclusions

itsfatduck5387fed53744
diff --git a/optimizerDuck/src/Core/Defaults.cs b/optimizerDuck/src/Core/Defaults.cs
index 394873d..e505c03 100644
--- a/optimizerDuck/src/Core/Defaults.cs
+++ b/optimizerDuck/src/Core/Defaults.cs
@@ -1,7 +1,7 @@
-using System.Diagnostics;
-using optimizerDuck.UI;
+using optimizerDuck.UI;
using optimizerDuck.UI.Components;
using Spectre.Console;
+using System.Diagnostics;
namespace optimizerDuck.Core;
@@ -54,9 +54,9 @@ public static class Defaults
// @formatter:on
HorizontalAlignment.Center
))
- { Border = CustomBoxBorder.UnderlineBorder, Padding = new Padding(0, 1, 0, 1) };
+ { Border = CustomBoxBorder.UnderlineBorder, Padding = new Padding(0, 1, 0, 1) };
- private static readonly string ExePath = Environment.ProcessPath!;
+ public static readonly string ExePath = Environment.ProcessPath!;
public static readonly string ExeDir = Path.GetDirectoryName(ExePath)!;
public static readonly string FileVersion = FileVersionInfo.GetVersionInfo(ExePath).FileVersion!;
diff --git a/optimizerDuck/src/Core/Helpers/SystemHelper.cs b/optimizerDuck/src/Core/Helpers/SystemHelper.cs
index f05e9f8..1808ee2 100644
--- a/optimizerDuck/src/Core/Helpers/SystemHelper.cs
+++ b/optimizerDuck/src/Core/Helpers/SystemHelper.cs
@@ -1,9 +1,9 @@
-using System.Diagnostics;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using optimizerDuck.Core.Services;
using optimizerDuck.UI;
using optimizerDuck.UI.Logger;
+using System.Diagnostics;
namespace optimizerDuck.Core.Helpers;
@@ -55,7 +55,7 @@ public static class SystemHelper
{
var result = ShellService.PowerShell($$"""
@{
- SelfPath = (Get-MpPreference).ExclusionPath -contains "{{Defaults.ExeDir}}";
+ SelfPath = (Get-MpPreference).ExclusionPath -contains "{{Defaults.ExePath}}";
RootPath = (Get-MpPreference).ExclusionPath -contains "{{Defaults.RootPath}}"
} | ConvertTo-Json
""");
@@ -63,7 +63,7 @@ public static class SystemHelper
var missingPaths = new List<string>();
if (exclusions != null && exclusions.TryGetValue("SelfPath", out var selfPathExcluded) && !selfPathExcluded)
{
- Log.LogWarning("Path not excluded: {SelfPath}", Defaults.ExeDir);
+ Log.LogWarning("Path not excluded: {SelfPath}", Defaults.ExePath);
missingPaths.Add(Defaults.ExeDir);
}