Skip to content

Commit

Permalink
Gracefully handle autostart missing on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Apr 30, 2024
1 parent 9e78a0a commit 6e0adba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/qz/installer/shortcut/WindowsShortcutCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

package qz.installer.shortcut;

import com.sun.jna.platform.win32.Win32Exception;
import mslinks.ShellLinkException;
import mslinks.ShellLinkHelper;
import qz.common.Constants;
Expand All @@ -32,7 +33,12 @@ public void createDesktopShortcut() {
}

public boolean canAutoStart() {
return Files.exists(Paths.get(WindowsSpecialFolders.COMMON_STARTUP.toString(), SHORTCUT_NAME));
try {
return Files.exists(Paths.get(WindowsSpecialFolders.COMMON_STARTUP.toString(), SHORTCUT_NAME));
} catch(Win32Exception e) {
log.warn("An exception occurred locating the startup folder; autostart cannot be determined.", e);
}
return false;
}

private void createShortcut(String folderPath) {
Expand Down

0 comments on commit 6e0adba

Please sign in to comment.