Skip to content

Commit d6ac7e0

Browse files
committed
Only back up Fiji.app if it exists
If you're freshly downloading Fiji.app we don't want to try to copy a file that doesn't exist. Closes #117
1 parent ae894b8 commit d6ac7e0

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/main/java/net/imagej/updater/Installer.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)