594 data.put("WIX36_ONLY_START",
595 canUseWix36Features ? "" : "<!--");
596 data.put("WIX36_ONLY_END",
597 canUseWix36Features ? "" : "-->");
598
599 if (MSI_SYSTEM_WIDE.fetchFrom(params)) {
600 data.put("INSTALL_SCOPE", "perMachine");
601 } else {
602 data.put("INSTALL_SCOPE", "perUser");
603 }
604
605 if (BIT_ARCH_64.fetchFrom(params)) {
606 data.put("PLATFORM", "x64");
607 data.put("WIN64", "yes");
608 } else {
609 data.put("PLATFORM", "x86");
610 data.put("WIN64", "no");
611 }
612
613 data.put("UI_BLOCK", getUIBlock(params));
614
615 List<Map<String, ? super Object>> secondaryLaunchers = SECONDARY_LAUNCHERS.fetchFrom(params);
616
617 StringBuilder secondaryLauncherIcons = new StringBuilder();
618 for (int i = 0; i < secondaryLaunchers.size(); i++) {
619 Map<String, ? super Object> sl = secondaryLaunchers.get(i);
620 // <Icon Id="DesktopIcon.exe" SourceFile="APPLICATION_ICON" />
621 if (SHORTCUT_HINT.fetchFrom(sl) || MENU_HINT.fetchFrom(sl)) {
622 File secondaryLauncher = new File(imageRootDir, WinAppBundler.getLauncherName(sl));
623 String secondaryLauncherPath = relativePath(imageRootDir, secondaryLauncher);
624 String secondaryLauncherIconPath = secondaryLauncherPath.replace(".exe", ".ico");
625
626 secondaryLauncherIcons.append(" <Icon Id=\"Launcher");
627 secondaryLauncherIcons.append(i);
628 secondaryLauncherIcons.append(".exe\" SourceFile=\"");
629 secondaryLauncherIcons.append(secondaryLauncherIconPath);
630 secondaryLauncherIcons.append("\" />\r\n");
631 }
632 }
633 data.put("SECONDARY_LAUNCHER_ICONS", secondaryLauncherIcons.toString());
669 String uiBlock = " <UI/>\n"; // UI-less element
670
671 if (INSTALLDIR_CHOOSER.fetchFrom(params)) {
672 boolean enableTweakForExcludingLicense = (getLicenseFile(params) == null);
673 uiBlock =
674 " <UI>\n" +
675 " <Property Id=\"WIXUI_INSTALLDIR\" Value=\"APPLICATIONFOLDER\" />\n" +
676 " <UIRef Id=\"WixUI_InstallDir\" />\n" +
677 (enableTweakForExcludingLicense ? TWEAK_FOR_EXCLUDING_LICENSE : "") +
678 " </UI>\n";
679 } else if (getLicenseFile(params) != null) {
680 uiBlock =
681 " <UI>\n" +
682 " <UIRef Id=\"WixUI_Minimal\" />\n" +
683 " </UI>\n";
684 }
685
686 return uiBlock;
687 }
688
689 private void walkFileTree(Map<String, ? super Object> params, File root, PrintStream out, String prefix) {
690 List<File> dirs = new ArrayList<>();
691 List<File> files = new ArrayList<>();
692
693 if (!root.isDirectory()) {
694 throw new RuntimeException(
695 MessageFormat.format(I18N.getString("error.cannot-walk-directory"), root.getAbsolutePath()));
696 }
697
698 //sort to files and dirs
699 File[] children = root.listFiles();
700 if (children != null) {
701 for (File f : children) {
702 if (f.isDirectory()) {
703 dirs.add(f);
704 } else {
705 files.add(f);
706 }
707 }
708 }
|
594 data.put("WIX36_ONLY_START",
595 canUseWix36Features ? "" : "<!--");
596 data.put("WIX36_ONLY_END",
597 canUseWix36Features ? "" : "-->");
598
599 if (MSI_SYSTEM_WIDE.fetchFrom(params)) {
600 data.put("INSTALL_SCOPE", "perMachine");
601 } else {
602 data.put("INSTALL_SCOPE", "perUser");
603 }
604
605 if (BIT_ARCH_64.fetchFrom(params)) {
606 data.put("PLATFORM", "x64");
607 data.put("WIN64", "yes");
608 } else {
609 data.put("PLATFORM", "x86");
610 data.put("WIN64", "no");
611 }
612
613 data.put("UI_BLOCK", getUIBlock(params));
614 data.put("APP_CDS_BLOCK", getAppCDSBlock(params));
615
616 List<Map<String, ? super Object>> secondaryLaunchers = SECONDARY_LAUNCHERS.fetchFrom(params);
617
618 StringBuilder secondaryLauncherIcons = new StringBuilder();
619 for (int i = 0; i < secondaryLaunchers.size(); i++) {
620 Map<String, ? super Object> sl = secondaryLaunchers.get(i);
621 // <Icon Id="DesktopIcon.exe" SourceFile="APPLICATION_ICON" />
622 if (SHORTCUT_HINT.fetchFrom(sl) || MENU_HINT.fetchFrom(sl)) {
623 File secondaryLauncher = new File(imageRootDir, WinAppBundler.getLauncherName(sl));
624 String secondaryLauncherPath = relativePath(imageRootDir, secondaryLauncher);
625 String secondaryLauncherIconPath = secondaryLauncherPath.replace(".exe", ".ico");
626
627 secondaryLauncherIcons.append(" <Icon Id=\"Launcher");
628 secondaryLauncherIcons.append(i);
629 secondaryLauncherIcons.append(".exe\" SourceFile=\"");
630 secondaryLauncherIcons.append(secondaryLauncherIconPath);
631 secondaryLauncherIcons.append("\" />\r\n");
632 }
633 }
634 data.put("SECONDARY_LAUNCHER_ICONS", secondaryLauncherIcons.toString());
670 String uiBlock = " <UI/>\n"; // UI-less element
671
672 if (INSTALLDIR_CHOOSER.fetchFrom(params)) {
673 boolean enableTweakForExcludingLicense = (getLicenseFile(params) == null);
674 uiBlock =
675 " <UI>\n" +
676 " <Property Id=\"WIXUI_INSTALLDIR\" Value=\"APPLICATIONFOLDER\" />\n" +
677 " <UIRef Id=\"WixUI_InstallDir\" />\n" +
678 (enableTweakForExcludingLicense ? TWEAK_FOR_EXCLUDING_LICENSE : "") +
679 " </UI>\n";
680 } else if (getLicenseFile(params) != null) {
681 uiBlock =
682 " <UI>\n" +
683 " <UIRef Id=\"WixUI_Minimal\" />\n" +
684 " </UI>\n";
685 }
686
687 return uiBlock;
688 }
689
690 private String getAppCDSBlock(Map<String, ? super Object> params) {
691 String cdsBlock = "";
692 if (UNLOCK_COMMERCIAL_FEATURES.fetchFrom(params) && ENABLE_APP_CDS.fetchFrom(params)) {
693 cdsBlock =
694 " <CustomAction Id=\"CACHE_CDS\"\n" +
695 " Directory=\"APPLICATIONFOLDER\"\n" +
696 " ExeCommand=\"[APPLICATIONFOLDER]" + WinAppBundler.getLauncherName(params) +" -Xappcds:generatecache\"\n" +
697 " Execute=\"commit\"\n" +
698 " Return=\"check\"/>\n" +
699 "\n" +
700 " <InstallExecuteSequence>\n" +
701 " <Custom Action=\"CACHE_CDS\" Before=\"InstallFinalize\" />\n" +
702 " </InstallExecuteSequence>";
703 }
704 return cdsBlock;
705 }
706
707 private void walkFileTree(Map<String, ? super Object> params, File root, PrintStream out, String prefix) {
708 List<File> dirs = new ArrayList<>();
709 List<File> files = new ArrayList<>();
710
711 if (!root.isDirectory()) {
712 throw new RuntimeException(
713 MessageFormat.format(I18N.getString("error.cannot-walk-directory"), root.getAbsolutePath()));
714 }
715
716 //sort to files and dirs
717 File[] children = root.listFiles();
718 if (children != null) {
719 for (File f : children) {
720 if (f.isDirectory()) {
721 dirs.add(f);
722 } else {
723 files.add(f);
724 }
725 }
726 }
|