Skip to content

Commit 5f8d5b0

Browse files
committed
Fix legacy shortcuts on Linux
Fixes shortcuts installed on Desktop or startup that used old launcher commands
1 parent a1ea315 commit 5f8d5b0

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/qz/deploy/LinuxDeploy.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ public boolean removeDesktopShortcut() {
4949

5050
@Override
5151
public boolean hasStartupShortcut() {
52-
return fileExists(System.getProperty("user.home") + "/.config/autostart/" + getShortcutName());
52+
String target = System.getProperty("user.home") + "/.config/autostart/";
53+
upgradeLegacyShortcut(target);
54+
return fileExists(target + getShortcutName());
5355
}
5456

5557
@Override
5658
public boolean hasDesktopShortcut() {
57-
return fileExists(System.getProperty("user.home") + "/Desktop/" + getShortcutName());
59+
String target = System.getProperty("user.home") + "/Desktop/";
60+
upgradeLegacyShortcut(target);
61+
return fileExists(target + getShortcutName());
5862
}
5963

6064
/**
@@ -81,5 +85,19 @@ public String getShortcutName() {
8185
public String getAppPath() {
8286
return "/usr/share/applications/" + getShortcutName();
8387
}
88+
89+
/**
90+
* Upgrade 1.9 shortcut to new 2.0 format
91+
* @return
92+
*/
93+
private boolean upgradeLegacyShortcut(String target) {
94+
String shortcut = target + Constants.ABOUT_TITLE + ".desktop";
95+
if (fileExists(shortcut)) {
96+
if (ShellUtilities.execute(new String[] { "rm", shortcut })) {
97+
return createShortcut(target);
98+
}
99+
}
100+
return false;
101+
}
84102
}
85103

0 commit comments

Comments
 (0)