382 + "types-for-file-association.advice")); |
382 + "types-for-file-association.advice")); |
383 } |
383 } |
384 } |
384 } |
385 } |
385 } |
386 |
386 |
387 // validate license file, if used, exists in the proper place |
|
388 if (p.containsKey(LICENSE_FILE.getID())) { |
|
389 List<RelativeFileSet> appResourcesList = |
|
390 APP_RESOURCES_LIST.fetchFrom(p); |
|
391 for (String license : LICENSE_FILE.fetchFrom(p)) { |
|
392 boolean found = false; |
|
393 for (RelativeFileSet appResources : appResourcesList) { |
|
394 found = found || appResources.contains(license); |
|
395 } |
|
396 if (!found) { |
|
397 throw new ConfigException( |
|
398 MessageFormat.format(I18N.getString( |
|
399 "error.license-missing"), license), |
|
400 MessageFormat.format(I18N.getString( |
|
401 "error.license-missing.advice"), license)); |
|
402 } |
|
403 } |
|
404 } |
|
405 |
|
406 return true; |
387 return true; |
407 } catch (RuntimeException re) { |
388 } catch (RuntimeException re) { |
408 if (re.getCause() instanceof ConfigException) { |
389 if (re.getCause() instanceof ConfigException) { |
409 throw (ConfigException) re.getCause(); |
390 throw (ConfigException) re.getCause(); |
410 } else { |
391 } else { |
480 MSI_IMAGE_DIR.fetchFrom(p), true); |
461 MSI_IMAGE_DIR.fetchFrom(p), true); |
481 } |
462 } |
482 |
463 |
483 p.put(WIN_APP_IMAGE.getID(), appDir); |
464 p.put(WIN_APP_IMAGE.getID(), appDir); |
484 |
465 |
485 List<String> licenseFiles = LICENSE_FILE.fetchFrom(p); |
466 String licenseFile = LICENSE_FILE.fetchFrom(p); |
486 if (licenseFiles != null) { |
467 if (licenseFile != null) { |
487 // need to copy license file to the root of win.app.image |
468 // need to copy license file to the working directory and convert to rtf if needed |
488 outerLoop: |
469 File lfile = new File(licenseFile); |
489 for (RelativeFileSet rfs : APP_RESOURCES_LIST.fetchFrom(p)) { |
470 File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); |
490 for (String s : licenseFiles) { |
471 IOUtils.copyFile(lfile, destFile); |
491 if (rfs.contains(s)) { |
472 ensureByMutationFileIsRTF(destFile); |
492 File lfile = new File(rfs.getBaseDirectory(), s); |
|
493 File destFile = new File(appDir, lfile.getName()); |
|
494 IOUtils.copyFile(lfile, destFile); |
|
495 ensureByMutationFileIsRTF(destFile); |
|
496 break outerLoop; |
|
497 } |
|
498 } |
|
499 } |
|
500 } |
473 } |
501 |
474 |
502 // copy file association icons |
475 // copy file association icons |
503 List<Map<String, ? super Object>> fileAssociations = |
476 List<Map<String, ? super Object>> fileAssociations = |
504 FILE_ASSOCIATIONS.fetchFrom(p); |
477 FILE_ASSOCIATIONS.fetchFrom(p); |
1109 private File getConfig_ProjectFile(Map<String, ? super Object> params) { |
1082 private File getConfig_ProjectFile(Map<String, ? super Object> params) { |
1110 return new File(CONFIG_ROOT.fetchFrom(params), |
1083 return new File(CONFIG_ROOT.fetchFrom(params), |
1111 APP_NAME.fetchFrom(params) + ".wxs"); |
1084 APP_NAME.fetchFrom(params) + ".wxs"); |
1112 } |
1085 } |
1113 |
1086 |
1114 private String getLicenseFile(Map<String, ? super Object> params) { |
1087 private String getLicenseFile(Map<String, ? super Object> p) { |
1115 List<String> licenseFiles = LICENSE_FILE.fetchFrom(params); |
1088 String licenseFile = LICENSE_FILE.fetchFrom(p); |
1116 if (licenseFiles == null || licenseFiles.isEmpty()) { |
1089 if (licenseFile != null) { |
1117 return null; |
1090 File lfile = new File(licenseFile); |
1118 } else { |
1091 File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); |
1119 return licenseFiles.get(0); |
1092 String filePath = destFile.getAbsolutePath(); |
1120 } |
1093 if (filePath.contains(" ")) { |
|
1094 return "\"" + filePath + "\""; |
|
1095 } else { |
|
1096 return filePath; |
|
1097 } |
|
1098 } |
|
1099 |
|
1100 return null; |
1121 } |
1101 } |
1122 |
1102 |
1123 private boolean prepareWiXConfig( |
1103 private boolean prepareWiXConfig( |
1124 Map<String, ? super Object> params) throws IOException { |
1104 Map<String, ? super Object> params) throws IOException { |
1125 return prepareMainProjectFile(params) && prepareContentList(params); |
1105 return prepareMainProjectFile(params) && prepareContentList(params); |