Skip to content

Commit 36655da

Browse files
committed
WIP: more warning
1 parent bc365cd commit 36655da

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/main/java/net/imagej/ui/swing/updater/LauncherMigrator.java

+17-11
Original file line numberDiff line numberDiff line change
@@ -128,29 +128,36 @@ void checkLaunchStatus() {
128128
}
129129

130130
/**
131-
* Updates platform-specific shortcuts to reference the new launcher,
132-
* including {@code .desktop} files on Linux.
131+
* Warns users to update any shortcuts to reference the new launcher.
132+
* Currently, this is recommended to be done manually.
133133
* <p>
134134
* The macOS-specific {@code Contents/Info.plist} is handled separately
135135
* by the Updater, as part of the switch to the new update site; see
136136
* {@link #migrateUpdateSite()}.
137137
* </p>
138-
* <p></p>
139-
* Windows users are advised to update their shortcuts by hand, because:
138+
* <p>
139+
* Linux users need to change any {@code .desktop} files.
140+
* </p>
141+
* <p>
142+
* Windows is particularly complicated, because:
140143
* A) we don't know where the user put their Fiji shortcuts&mdash;they
141144
* could be in the Start menu, on the desktop, or elsewhere and pinned
142145
* to the taskbar; and B) the .lnk file format is an opaque binary
143146
* format and I'm not going to code up something to hack it just for
144147
* this transitional migration code that will be obsolete in a few months.
145148
* </p>
146149
* <p>
147-
* Finally, old launchers are renamed with {@code .backup} extension in
150+
* Note that launchers will be renamed with the {@code .backup} extension in
148151
* case there are any missed shortcuts, so that launch fails fast at the
149-
* OS level rather than potentially exploding at the application level.
152+
* OS level rather than potentially exploding at the application level; see
153+
* {@link #startExeRenameAndRestart(Path, String)}
150154
* </p>
151155
*/
152-
private void warnAboutShortcuts() {
153-
// If no old launchers are present, assume we already did this.
156+
private void warnAboutShortcuts(File exeFile) {
157+
158+
// FIXME warn users on all platforms not just windows and use the exe file to
159+
// tell them the new executable name
160+
154161

155162
// Fix links within Linux .desktop files.
156163
// ~/.local/share/applications
@@ -164,8 +171,6 @@ private void warnAboutShortcuts() {
164171
// one of these files is fiji/fiji/scripts/Plugins/Utilities/Create_Desktop_Icon.bsh,
165172
// but it's outdated. So what is making these files these days??
166173

167-
// TODO On MAC, Fiji.app is now a subdir of Fiji.. may want to rename the
168-
// top level Fiji.app to Fiji.
169174
if (OS_WIN) {
170175
// FIXME: Warn user to update any shortcuts!
171176
uiService.showDialog(
@@ -385,8 +390,8 @@ private void switchToNewLauncher() {
385390
// Switch update sites, and then we can finally relaunch safely with the
386391
// new launcher.
387392
migrateUpdateSite();
388-
warnAboutShortcuts();
389393
File exeFile = exeFile(appSlug, appDir);
394+
warnAboutShortcuts(exeFile);
390395
try {
391396
startExeRenameAndRestart(appDir.toPath(), exeFile.getAbsolutePath());
392397
appService.getContext().dispose();
@@ -455,6 +460,7 @@ private static void startExeRenameAndRestart(Path appDir,
455460
);
456461
} else {
457462
// Unix/Linux/Mac implementation using bash
463+
// FIXME On MAC, Fiji.app is now a subdir of Fiji.. also rename the top level Fiji.app to Fiji
458464
pb = new ProcessBuilder(
459465
"bash",
460466
"-c",

0 commit comments

Comments
 (0)