Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
fix OneDrive installation detection via file-based lookup
Greedeksdb24c28f1c26
diff --git a/.Source/GTweak/Utilities/Controls/PathLocator.cs b/.Source/GTweak/Utilities/Controls/PathLocator.csindex 1575f577..3a12a602 100644--- a/.Source/GTweak/Utilities/Controls/PathLocator.cs+++ b/.Source/GTweak/Utilities/Controls/PathLocator.cs@@ -76,6 +76,8 @@ namespace GTweak.Utilities.Controlsinternal static readonly string WallpaperCache = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Microsoft", "Windows", "Themes");internal static readonly string Edge = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft", "Edge");++ internal static readonly string OneDrive = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "OneDrive");}internal static class Executable@@ -297,7 +299,15 @@ namespace GTweak.Utilities.Controlsinternal static readonly string Explorer = FindExecutablePath("explorer.exe");- internal static readonly string OneDrive = FindExecutablePath("onedrivesetup.exe");+ internal static readonly string OneDriveSetup = FindExecutablePath("onedrivesetup.exe");++ internal static readonly string[] OneDrive = new[]+ {+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "OneDrive", "OneDrive.exe"),+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "OneDrive", "Update", "OneDrive.exe"),+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft OneDrive", "OneDrive.exe"),+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft OneDrive", "OneDrive.exe"),+ };internal static readonly string DisablingWD = Path.Combine(Folders.DefenderBackup, "DisablingWD.exe");diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.csindex 43406744..fbdba289 100644--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs@@ -33,9 +33,8 @@ namespace GTweak.Utilities.Tweaks}}- internal static bool IsOneDriveInstalled => File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "OneDrive", "OneDrive.exe")) ||- File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft OneDrive", "OneDrive.exe")) ||- File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft OneDrive", "OneDrive.exe"));+ internal static bool IsOneDriveInstalled => PathLocator.Executable.OneDrive.Any(File.Exists) || (Directory.Exists(PathLocator.Folders.OneDrive) &&+ Directory.EnumerateDirectories(PathLocator.Folders.OneDrive).Any(dir => File.Exists(Path.Combine(dir, "OneDrive.exe"))));internal static bool IsEdgeInstalled => Directory.Exists(PathLocator.Folders.Edge);@@ -157,7 +156,7 @@ namespace GTweak.Utilities.Tweaksinternal static async Task RestoreOneDriveFolder(){- await CommandExecutor.InvokeRunCommand($@"/c {PathLocator.Executable.OneDrive}").ConfigureAwait(false);+ await CommandExecutor.InvokeRunCommand($@"/c {PathLocator.Executable.OneDriveSetup}").ConfigureAwait(false);SetTaskState(true, oneDriveTask);@@ -169,7 +168,7 @@ namespace GTweak.Utilities.Tweaks{if (packageName == "OneDrive"){- await CommandExecutor.InvokeRunCommand($@"/c taskkill /f /im OneDrive.exe & {PathLocator.Executable.OneDrive} /uninstall").ConfigureAwait(false);+ await CommandExecutor.InvokeRunCommand($@"/c taskkill /f /im OneDrive.exe & {PathLocator.Executable.OneDriveSetup} /uninstall").ConfigureAwait(false);RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");diff --git a/.Source/GTweak/View/PackagesView.xaml.cs b/.Source/GTweak/View/PackagesView.xaml.csindex f7300072..22954f2e 100644--- a/.Source/GTweak/View/PackagesView.xaml.cs+++ b/.Source/GTweak/View/PackagesView.xaml.cs@@ -68,7 +68,7 @@ namespace GTweak.Viewif (toggleButton.IsChecked == false && packageName == "OneDrive"){- if (string.IsNullOrWhiteSpace(PathLocator.Executable.OneDrive))+ if (string.IsNullOrWhiteSpace(PathLocator.Executable.OneDriveSetup)){NotificationManager.Show("warn", "error_onedrive_noty").Perform();}