26 package jdk.jpackage.internal; |
26 package jdk.jpackage.internal; |
27 |
27 |
28 import java.io.*; |
28 import java.io.*; |
29 import java.nio.charset.Charset; |
29 import java.nio.charset.Charset; |
30 import java.nio.file.Files; |
30 import java.nio.file.Files; |
|
31 import java.nio.file.Path; |
31 import java.nio.file.Paths; |
32 import java.nio.file.Paths; |
32 import java.text.MessageFormat; |
33 import java.text.MessageFormat; |
33 import java.util.*; |
34 import java.util.*; |
34 import java.util.regex.Pattern; |
35 import java.util.regex.Pattern; |
35 import javax.xml.stream.XMLOutputFactory; |
36 import javax.xml.stream.XMLOutputFactory; |
36 import javax.xml.stream.XMLStreamException; |
37 import javax.xml.stream.XMLStreamException; |
37 import javax.xml.stream.XMLStreamWriter; |
38 import javax.xml.stream.XMLStreamWriter; |
|
39 import static jdk.jpackage.internal.OverridableResource.createResource; |
38 |
40 |
39 import static jdk.jpackage.internal.WindowsBundlerParam.*; |
41 import static jdk.jpackage.internal.WindowsBundlerParam.*; |
40 |
42 |
41 /** |
43 /** |
42 * WinMsiBundler |
44 * WinMsiBundler |
525 APP_NAME.fetchFrom(params) + "-post-image.wsf"); |
527 APP_NAME.fetchFrom(params) + "-post-image.wsf"); |
526 } |
528 } |
527 |
529 |
528 private void prepareBasicProjectConfig( |
530 private void prepareBasicProjectConfig( |
529 Map<String, ? super Object> params) throws IOException { |
531 Map<String, ? super Object> params) throws IOException { |
530 fetchResource(getConfig_Script(params).getName(), |
532 |
531 I18N.getString("resource.post-install-script"), |
533 Path scriptPath = getConfig_Script(params).toPath(); |
532 (String) null, |
534 |
533 getConfig_Script(params), |
535 createResource(null, params) |
534 VERBOSE.fetchFrom(params), |
536 .setCategory(I18N.getString("resource.post-install-script")) |
535 RESOURCE_DIR.fetchFrom(params)); |
537 .saveToFile(scriptPath); |
536 } |
538 } |
537 |
539 |
538 private static String relativePath(File basedir, File file) { |
540 private static String relativePath(File basedir, File file) { |
539 return file.getAbsolutePath().substring( |
541 return file.getAbsolutePath().substring( |
540 basedir.getAbsolutePath().length() + 1); |
542 basedir.getAbsolutePath().length() + 1); |
661 |
663 |
662 // Copy CA dll to include with installer |
664 // Copy CA dll to include with installer |
663 if (INSTALLDIR_CHOOSER.fetchFrom(params)) { |
665 if (INSTALLDIR_CHOOSER.fetchFrom(params)) { |
664 data.put("JpInstallDirChooser", "yes"); |
666 data.put("JpInstallDirChooser", "yes"); |
665 String fname = "wixhelper.dll"; |
667 String fname = "wixhelper.dll"; |
666 try (InputStream is = getResourceAsStream(fname)) { |
668 try (InputStream is = OverridableResource.readDefault(fname)) { |
667 Files.copy(is, Paths.get( |
669 Files.copy(is, Paths.get( |
668 CONFIG_ROOT.fetchFrom(params).getAbsolutePath(), |
670 CONFIG_ROOT.fetchFrom(params).getAbsolutePath(), |
669 fname)); |
671 fname)); |
670 } |
672 } |
671 } |
673 } |
672 |
674 |
673 // Copy l10n files. |
675 // Copy l10n files. |
674 for (String loc : Arrays.asList("en", "ja", "zh_CN")) { |
676 for (String loc : Arrays.asList("en", "ja", "zh_CN")) { |
675 String fname = "MsiInstallerStrings_" + loc + ".wxl"; |
677 String fname = "MsiInstallerStrings_" + loc + ".wxl"; |
676 try (InputStream is = getResourceAsStream(fname)) { |
678 try (InputStream is = OverridableResource.readDefault(fname)) { |
677 Files.copy(is, Paths.get( |
679 Files.copy(is, Paths.get( |
678 CONFIG_ROOT.fetchFrom(params).getAbsolutePath(), |
680 CONFIG_ROOT.fetchFrom(params).getAbsolutePath(), |
679 fname)); |
681 fname)); |
680 } |
682 } |
681 } |
683 } |
682 |
684 |
683 try (InputStream is = getResourceAsStream("main.wxs")) { |
685 try (InputStream is = OverridableResource.readDefault("main.wxs")) { |
684 Files.copy(is, Paths.get( |
686 Files.copy(is, Paths.get( |
685 getConfig_ProjectFile(params).getAbsolutePath())); |
687 getConfig_ProjectFile(params).getAbsolutePath())); |
686 } |
688 } |
687 |
689 |
688 return data; |
690 return data; |