Esempio n. 1
0
 private void addIcon(int id, File icon) {
   if (icon == null || icon.getPath().equals("")) {
     return;
   }
   _sb.append(id);
   _sb.append(" ICON DISCARDABLE \"");
   _sb.append(getPath(Util.getAbsoluteFile(ConfigPersister.getInstance().getConfigPath(), icon)));
   _sb.append("\"\n");
 }
Esempio n. 2
0
 private void addBitmap(int id, File bitmap) {
   if (bitmap == null) {
     return;
   }
   _sb.append(id);
   _sb.append(" BITMAP \"");
   _sb.append(
       getPath(Util.getAbsoluteFile(ConfigPersister.getInstance().getConfigPath(), bitmap)));
   _sb.append("\"\n");
 }
Esempio n. 3
0
 private void addManifest(int id, File manifest) {
   if (manifest == null || manifest.getPath().equals("")) {
     return;
   }
   _sb.append(id);
   _sb.append(" 24 \"");
   _sb.append(
       getPath(Util.getAbsoluteFile(ConfigPersister.getInstance().getConfigPath(), manifest)));
   _sb.append("\"\n");
 }
Esempio n. 4
0
  public File build(Config c) throws IOException {
    _sb.append("LANGUAGE ");
    _sb.append(LANG_NEUTRAL);
    _sb.append(", ");
    _sb.append(SUBLANG_DEFAULT);
    _sb.append('\n');
    addVersionInfo(c.getVersionInfo());
    addJre(c.getJre());
    addManifest(MANIFEST, c.getManifest());
    addIcon(APP_ICON, c.getIcon());
    addText(ERR_TITLE, c.getErrTitle());
    addText(DOWNLOAD_URL, c.getDownloadUrl());
    addText(SUPPORT_URL, c.getSupportUrl());
    addText(CMD_LINE, c.getCmdLine());
    addWindowsPath(CHDIR, c.getChdir());
    addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass()));
    addTrue(SET_PROC_NAME, c.isCustomProcName());
    addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive());
    addSplash(c.getSplash());
    addMessages(c);

    if (c.getSingleInstance() != null) {
      addText(MUTEX_NAME, c.getSingleInstance().getMutexName());
      addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle());
    }

    if (c.getVariables() != null && !c.getVariables().isEmpty()) {
      StringBuffer vars = new StringBuffer();
      append(vars, c.getVariables(), "\t");
      addText(ENV_VARIABLES, vars.toString());
    }

    // MAIN_CLASS / JAR
    addTrue(WRAPPER, !c.isDontWrapJar());
    if (c.getClassPath() != null) {
      addText(MAIN_CLASS, c.getClassPath().getMainClass());
      addWindowsPath(CLASSPATH, c.getClassPath().getPathsString());
    }
    if (c.isDontWrapJar() && c.getJar() != null) {
      addWindowsPath(JAR, c.getJar().getPath());
    }

    File f = Util.createTempFile("rc");
    BufferedWriter w = new BufferedWriter(new FileWriter(f));
    w.write(_sb.toString());
    w.close();
    return f;
  }