Skip to content

Commit

Permalink
Fix legacy shortcuts on Linux
Browse files Browse the repository at this point in the history
Fixes shortcuts installed on Desktop or startup that used old launcher commands
  • Loading branch information
tresf committed May 10, 2016
1 parent a1ea315 commit 5f8d5b0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/qz/deploy/LinuxDeploy.java
Expand Up @@ -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());
}

/**
Expand All @@ -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;
}
}

0 comments on commit 5f8d5b0

Please sign in to comment.