Exemplo n.º 1
0
 private String createXDGDirectory(String menuName, String icon, String comment) {
   String menuDirectoryDescriptor =
       "[Desktop Entry]\n"
           + "Name=$Name\n"
           + "Comment=$Comment\n"
           + "Icon=$Icon\n"
           + "Type=Directory\n"
           + "Encoding=UTF-8";
   menuDirectoryDescriptor = StringTool.replace(menuDirectoryDescriptor, "$Name", menuName);
   menuDirectoryDescriptor = StringTool.replace(menuDirectoryDescriptor, "$Comment", comment);
   menuDirectoryDescriptor = StringTool.replace(menuDirectoryDescriptor, "$Icon", icon);
   return menuDirectoryDescriptor;
 }
Exemplo n.º 2
0
  /**
   * Helper to format a message to create shortcuts for the current platform.
   *
   * @return a formatted message
   */
  public String getCreateShortcutsPrompt() {
    Messages messages = installData.getMessages();
    String menuKind = messages.get("ShortcutPanel.regular.StartMenu:Start-Menu");

    if (installData.getPlatform().isA(UNIX) && UnixHelper.kdeIsInstalled()) {
      menuKind = messages.get("ShortcutPanel.regular.StartMenu:K-Menu");
    }

    return StringTool.replace(messages.get("ShortcutPanel.regular.create"), "StartMenu", menuKind);
  }
  /**
   * Gets the Folders where to place the program-groups and their shortcuts, for the given usertype.
   *
   * @see com.izforge.izpack.util.os.Shortcut#getProgramsFolder(int)
   */
  public String getProgramsFolder(int current_user) {
    /** CURRENT_USER = 0; the constant to use for selecting the current user. */
    int USER = 0;

    if (current_user == Shortcut.CURRENT_USER) USER = ShellLink.CURRENT_USER;
    else if (current_user == Shortcut.ALL_USERS) USER = ShellLink.ALL_USERS;

    String result = null;
    try {
      result =
          new String(
              shortcut.getLinkPath(USER).getBytes(StringTool.getPlatformEncoding()),
              StringTool.getPlatformEncoding());
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Debug.log(CLASS + myClass + ".getProgramsFolder() '" + current_user + "', '" + result + "'");
    return result;
  }
Exemplo n.º 4
0
  /**
   * Gets the Folders where to place the program-groups and their shortcuts, for the given usertype.
   *
   * @see com.izforge.izpack.util.os.Shortcut#getProgramsFolder(int)
   */
  @Override
  public String getProgramsFolder(int current_user) {
    /** CURRENT_USER = 0; the constant to use for selecting the current user. */
    int USER = 0;

    if (current_user == Shortcut.CURRENT_USER) {
      USER = ShellLink.CURRENT_USER;
    } else if (current_user == Shortcut.ALL_USERS) {
      USER = ShellLink.ALL_USERS;
    }

    String result = null;
    try {
      result =
          new String(
              shortcut.getLinkPath(USER).getBytes(StringTool.getPlatformEncoding()),
              StringTool.getPlatformEncoding());
    } catch (UnsupportedEncodingException e) {
      logger.log(Level.WARNING, e.getMessage(), e);
    }
    return result;
  }