This repository was archived by the owner on Jul 18, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathUtilities.cs
More file actions
40 lines (36 loc) · 1.36 KB
/
Utilities.cs
File metadata and controls
40 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Droplex;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flow.Launcher.Plugin.Everything
{
internal static class Utilities
{
internal static string GetInstalledPath()
{
string displayName;
string uninstallString;
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
if (key != null)
{
foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName)))
{
displayName = subkey.GetValue("DisplayName") as string;
if (displayName != null && displayName.Contains("Everything"))
{
uninstallString = subkey.GetValue("UninstallString") as string;
return Path.Combine(Path.GetDirectoryName(uninstallString), "Everything.exe");
}
}
}
var scoopInstalledPath = Environment.ExpandEnvironmentVariables(@"%userprofile%\scoop\apps\everything\current\Everything.exe");
if (File.Exists(scoopInstalledPath))
return scoopInstalledPath;
return string.Empty;
}
}
}