@@ -154,20 +154,24 @@ public synchronized void start() throws IOException {
154154 }
155155 // If there is a Mac app update, we need to flag ALL installed files in Fiji.app for update
156156 if (updateMacApp ) {
157- for (FileObject installed : files .installed ()) {
158- if (installed .filename .contains ("Fiji.app" )) {
159- installed .stageForUpdate (files , true );
160- }
161- }
162157 Path macBundlePath = files .prefix ("Fiji.app" ).toPath ();
163158 File backupAppFile = files .prefix ("Fiji.old.app" );
164159 Path backupAppPath = backupAppFile .toPath ();
165- // Remove the existing Fiji.old.app if it exists
166- if (backupAppFile .exists ()) {
167- deleteDirectory (backupAppPath );
160+
161+ // If there's no Fiji.app folder to back up we can just skip this step
162+ if (Files .exists (macBundlePath )) {
163+ for (FileObject installed : files .installed ()) {
164+ if (installed .filename .contains ("Fiji.app" )) {
165+ installed .stageForUpdate (files , true );
166+ }
167+ }
168+ // Remove the existing Fiji.old.app if it exists
169+ if (backupAppFile .exists ()) {
170+ deleteDirectory (backupAppPath );
171+ }
172+ // Create a new Fiji.old.app backup
173+ copyDirectory (macBundlePath , backupAppPath );
168174 }
169- // Create a new Fiji.old.app backup
170- copyDirectory (macBundlePath , backupAppPath );
171175 }
172176
173177 for (final FileObject file : files .toInstallOrUpdate ()) {
0 commit comments