From 5f8d5b086aaaa2a05b0fa1c79294ef2c36769f9d Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Mon, 9 May 2016 22:26:22 -0400 Subject: [PATCH] Fix legacy shortcuts on Linux Fixes shortcuts installed on Desktop or startup that used old launcher commands --- src/qz/deploy/LinuxDeploy.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/qz/deploy/LinuxDeploy.java b/src/qz/deploy/LinuxDeploy.java index b255f7841..cb72b559f 100644 --- a/src/qz/deploy/LinuxDeploy.java +++ b/src/qz/deploy/LinuxDeploy.java @@ -49,12 +49,16 @@ public boolean removeDesktopShortcut() { @Override public boolean hasStartupShortcut() { - return fileExists(System.getProperty("user.home") + "/.config/autostart/" + getShortcutName()); + String target = System.getProperty("user.home") + "/.config/autostart/"; + upgradeLegacyShortcut(target); + return fileExists(target + getShortcutName()); } @Override public boolean hasDesktopShortcut() { - return fileExists(System.getProperty("user.home") + "/Desktop/" + getShortcutName()); + String target = System.getProperty("user.home") + "/Desktop/"; + upgradeLegacyShortcut(target); + return fileExists(target + getShortcutName()); } /** @@ -81,5 +85,19 @@ public String getShortcutName() { public String getAppPath() { return "/usr/share/applications/" + getShortcutName(); } + + /** + * Upgrade 1.9 shortcut to new 2.0 format + * @return + */ + private boolean upgradeLegacyShortcut(String target) { + String shortcut = target + Constants.ABOUT_TITLE + ".desktop"; + if (fileExists(shortcut)) { + if (ShellUtilities.execute(new String[] { "rm", shortcut })) { + return createShortcut(target); + } + } + return false; + } }