mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Check registry target path
This commit is contained in:
parent
c67bfad28a
commit
637685b8a9
3 changed files with 7 additions and 11 deletions
|
@ -96,7 +96,7 @@ public static bool CheckShellContextMenu()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return CheckRegistry(ShellExtMenuFilesCmd) && CheckRegistry(ShellExtMenuDirectoryCmd);
|
return CheckRegistry(ShellExtMenuFilesCmd, null, ShellExtPath) && CheckRegistry(ShellExtMenuDirectoryCmd, null, ShellExtPath);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,8 @@ private static bool Create(string shortcutPath, string targetPath, string argume
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(shortcutPath) && !string.IsNullOrEmpty(targetPath) && File.Exists(targetPath))
|
if (!string.IsNullOrEmpty(shortcutPath) && !string.IsNullOrEmpty(targetPath) && File.Exists(targetPath))
|
||||||
{
|
{
|
||||||
|
Delete(shortcutPath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IWshShell wsh = new WshShellClass();
|
IWshShell wsh = new WshShellClass();
|
||||||
|
|
|
@ -35,27 +35,21 @@ public static class IntegrationHelpers
|
||||||
{
|
{
|
||||||
private static string GetStartupTargetPath()
|
private static string GetStartupTargetPath()
|
||||||
{
|
{
|
||||||
string path;
|
|
||||||
|
|
||||||
#if STEAM
|
#if STEAM
|
||||||
path = Helpers.GetAbsolutePath("../ShareX_Launcher.exe");
|
return Helpers.GetAbsolutePath("../ShareX_Launcher.exe");
|
||||||
#else
|
#else
|
||||||
path = Application.ExecutablePath;
|
return Application.ExecutablePath;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckStartupShortcut()
|
public static bool CheckStartupShortcut()
|
||||||
{
|
{
|
||||||
string targetPath = GetStartupTargetPath();
|
return ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup, GetStartupTargetPath());
|
||||||
return ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup, targetPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateStartupShortcut(bool create)
|
public static void CreateStartupShortcut(bool create)
|
||||||
{
|
{
|
||||||
string targetPath = GetStartupTargetPath();
|
ShortcutHelpers.SetShortcut(create, Environment.SpecialFolder.Startup, GetStartupTargetPath(), "-silent");
|
||||||
ShortcutHelpers.SetShortcut(create, Environment.SpecialFolder.Startup, targetPath, "-silent");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckShellContextMenuButton()
|
public static bool CheckShellContextMenuButton()
|
||||||
|
|
Loading…
Reference in a new issue