mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +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
|
||||
{
|
||||
return CheckRegistry(ShellExtMenuFilesCmd) && CheckRegistry(ShellExtMenuDirectoryCmd);
|
||||
return CheckRegistry(ShellExtMenuFilesCmd, null, ShellExtPath) && CheckRegistry(ShellExtMenuDirectoryCmd, null, ShellExtPath);
|
||||
}
|
||||
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))
|
||||
{
|
||||
Delete(shortcutPath);
|
||||
|
||||
try
|
||||
{
|
||||
IWshShell wsh = new WshShellClass();
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue