File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,16 @@ public boolean removeDesktopShortcut() {
49
49
50
50
@ Override
51
51
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 ());
53
55
}
54
56
55
57
@ Override
56
58
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 ());
58
62
}
59
63
60
64
/**
@@ -81,5 +85,19 @@ public String getShortcutName() {
81
85
public String getAppPath () {
82
86
return "/usr/share/applications/" + getShortcutName ();
83
87
}
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
+ }
84
102
}
85
103
You can’t perform that action at this time.
0 commit comments