Skip to content

Commit

Permalink
Merge pull request #288 from lherschi/windows_menu_entry
Browse files Browse the repository at this point in the history
sanitize filename for the menu entry to prevent java.nio.file.Invalid…
  • Loading branch information
judovana authored Jun 12, 2019
2 parents 1e69631 + 2936d16 commit ddcd44d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ public void createWindowsMenu() throws IOException {
sl.setIconLocation(iconLocation);
ul.setIconLocation(iconLocation);
}
sl.saveTo(path + "/" + file.getInformation().getTitle()+ ".lnk");
ul.saveTo(path + "/Uninstall " + file.getInformation().getTitle() + ".lnk");
final String link = FileUtils.sanitizeFileName(file.getInformation().getTitle() + ".lnk", '-');
sl.saveTo(path + "/" + link);
ul.saveTo(path + "/Uninstall " + link);
// write shortcuts to list
manageShortcutList(ManageMode.A, path + "/" + file.getInformation().getTitle() + ".lnk");
manageShortcutList(ManageMode.A, path + "/Uninstall " + file.getInformation().getTitle() + ".lnk");
manageShortcutList(ManageMode.A, path + "/" + link);
manageShortcutList(ManageMode.A, path + "/Uninstall " + link);
}

private void manageShortcutList(ManageMode mode, String path) throws IOException {
Expand Down

0 comments on commit ddcd44d

Please sign in to comment.