Check registry target path

This commit is contained in:
Jaex 2015-10-12 11:26:21 +03:00
parent c67bfad28a
commit 637685b8a9
3 changed files with 7 additions and 11 deletions

View file

@ -96,7 +96,7 @@ public static bool CheckShellContextMenu()
{
try
{
return CheckRegistry(ShellExtMenuFilesCmd) && CheckRegistry(ShellExtMenuDirectoryCmd);
return CheckRegistry(ShellExtMenuFilesCmd, null, ShellExtPath) && CheckRegistry(ShellExtMenuDirectoryCmd, null, ShellExtPath);
}
catch (Exception e)
{

View file

@ -70,6 +70,8 @@ private static bool Create(string shortcutPath, string targetPath, string argume
{
if (!string.IsNullOrEmpty(shortcutPath) && !string.IsNullOrEmpty(targetPath) && File.Exists(targetPath))
{
Delete(shortcutPath);
try
{
IWshShell wsh = new WshShellClass();

View file

@ -35,27 +35,21 @@ public static class IntegrationHelpers
{
private static string GetStartupTargetPath()
{
string path;
#if STEAM
path = Helpers.GetAbsolutePath("../ShareX_Launcher.exe");
return Helpers.GetAbsolutePath("../ShareX_Launcher.exe");
#else
path = Application.ExecutablePath;
return Application.ExecutablePath;
#endif
return path;
}
public static bool CheckStartupShortcut()
{
string targetPath = GetStartupTargetPath();
return ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup, targetPath);
return ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup, GetStartupTargetPath());
}
public static void CreateStartupShortcut(bool create)
{
string targetPath = GetStartupTargetPath();
ShortcutHelpers.SetShortcut(create, Environment.SpecialFolder.Startup, targetPath, "-silent");
ShortcutHelpers.SetShortcut(create, Environment.SpecialFolder.Startup, GetStartupTargetPath(), "-silent");
}
public static bool CheckShellContextMenuButton()