author | herrick |
Mon, 11 Mar 2019 14:44:00 -0400 | |
branch | JDK-8200758-branch |
changeset 57256 | d7c27451f759 |
parent 57255 | f686bda3b831 |
child 57283 | 0b0be19f79e4 |
permissions | -rw-r--r-- |
57038 | 1 |
/* |
57106
ea870b9ce89a
8216492: Update copyright of all new jpackage fils to 2019
kcr
parents:
57103
diff
changeset
|
2 |
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
57038 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
57039 | 26 |
package jdk.jpackage.internal; |
57038 | 27 |
|
28 |
import java.io.*; |
|
29 |
import java.nio.charset.Charset; |
|
30 |
import java.nio.file.Files; |
|
31 |
import java.text.MessageFormat; |
|
32 |
import java.util.*; |
|
33 |
import java.util.regex.Matcher; |
|
34 |
import java.util.regex.Pattern; |
|
35 |
||
57039 | 36 |
import static jdk.jpackage.internal.WindowsBundlerParam.*; |
57038 | 37 |
|
38 |
public class WinExeBundler extends AbstractBundler { |
|
39 |
||
40 |
private static final ResourceBundle I18N = ResourceBundle.getBundle( |
|
57059 | 41 |
"jdk.jpackage.internal.resources.WinResources"); |
57038 | 42 |
|
43 |
public static final BundlerParamInfo<WinAppBundler> APP_BUNDLER = |
|
44 |
new WindowsBundlerParam<>( |
|
45 |
"win.app.bundler", |
|
46 |
WinAppBundler.class, |
|
47 |
params -> new WinAppBundler(), |
|
48 |
null); |
|
49 |
||
50 |
public static final BundlerParamInfo<File> EXE_IMAGE_DIR = |
|
51 |
new WindowsBundlerParam<>( |
|
52 |
"win.exe.imageDir", |
|
53 |
File.class, |
|
54 |
params -> { |
|
55 |
File imagesRoot = IMAGES_ROOT.fetchFrom(params); |
|
56 |
if (!imagesRoot.exists()) imagesRoot.mkdirs(); |
|
57 |
return new File(imagesRoot, "win-exe.image"); |
|
58 |
}, |
|
59 |
(s, p) -> null); |
|
60 |
||
61 |
public static final BundlerParamInfo<File> WIN_APP_IMAGE = |
|
62 |
new WindowsBundlerParam<>( |
|
63 |
"win.app.image", |
|
64 |
File.class, |
|
65 |
null, |
|
66 |
(s, p) -> null); |
|
67 |
||
57062
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
68 |
public static final BundlerParamInfo<UUID> UPGRADE_UUID = |
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
69 |
new WindowsBundlerParam<>( |
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
70 |
Arguments.CLIOptions.WIN_UPGRADE_UUID.getId(), |
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
71 |
UUID.class, |
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
72 |
params -> UUID.randomUUID(), |
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
73 |
(s, p) -> UUID.fromString(s)); |
57038 | 74 |
|
75 |
public static final StandardBundlerParam<Boolean> EXE_SYSTEM_WIDE = |
|
76 |
new StandardBundlerParam<>( |
|
77 |
Arguments.CLIOptions.WIN_PER_USER_INSTALLATION.getId(), |
|
78 |
Boolean.class, |
|
79 |
params -> true, // default to system wide |
|
80 |
(s, p) -> (s == null || "null".equalsIgnoreCase(s))? null |
|
81 |
: Boolean.valueOf(s) |
|
82 |
); |
|
83 |
public static final StandardBundlerParam<String> PRODUCT_VERSION = |
|
84 |
new StandardBundlerParam<>( |
|
85 |
"win.msi.productVersion", |
|
86 |
String.class, |
|
87 |
VERSION::fetchFrom, |
|
88 |
(s, p) -> s |
|
89 |
); |
|
90 |
||
91 |
public static final StandardBundlerParam<Boolean> MENU_HINT = |
|
92 |
new WindowsBundlerParam<>( |
|
93 |
Arguments.CLIOptions.WIN_MENU_HINT.getId(), |
|
94 |
Boolean.class, |
|
95 |
params -> false, |
|
96 |
(s, p) -> (s == null || |
|
97 |
"null".equalsIgnoreCase(s))? true : Boolean.valueOf(s) |
|
98 |
); |
|
99 |
||
100 |
public static final StandardBundlerParam<Boolean> SHORTCUT_HINT = |
|
101 |
new WindowsBundlerParam<>( |
|
102 |
Arguments.CLIOptions.WIN_SHORTCUT_HINT.getId(), |
|
103 |
Boolean.class, |
|
104 |
params -> false, |
|
105 |
(s, p) -> (s == null || |
|
106 |
"null".equalsIgnoreCase(s))? false : Boolean.valueOf(s) |
|
107 |
); |
|
108 |
||
109 |
private final static String DEFAULT_EXE_PROJECT_TEMPLATE = "template.iss"; |
|
110 |
private final static String DEFAULT_JRE_EXE_TEMPLATE = "template.jre.iss"; |
|
111 |
private static final String TOOL_INNO_SETUP_COMPILER = "iscc.exe"; |
|
112 |
||
113 |
public static final BundlerParamInfo<String> |
|
114 |
TOOL_INNO_SETUP_COMPILER_EXECUTABLE = new WindowsBundlerParam<>( |
|
115 |
"win.exe.iscc.exe", |
|
116 |
String.class, |
|
117 |
params -> { |
|
118 |
for (String dirString : (System.getenv("PATH") |
|
119 |
+ ";C:\\Program Files (x86)\\Inno Setup 5;" |
|
120 |
+ "C:\\Program Files\\Inno Setup 5").split(";")) { |
|
121 |
File f = new File(dirString.replace("\"", ""), |
|
122 |
TOOL_INNO_SETUP_COMPILER); |
|
123 |
if (f.isFile()) { |
|
124 |
return f.toString(); |
|
125 |
} |
|
126 |
} |
|
127 |
return null; |
|
128 |
}, |
|
129 |
null); |
|
130 |
||
131 |
@Override |
|
132 |
public String getName() { |
|
57059 | 133 |
return getString("exe.bundler.name"); |
57038 | 134 |
} |
135 |
||
136 |
@Override |
|
137 |
public String getDescription() { |
|
57059 | 138 |
return getString("exe.bundler.description"); |
57038 | 139 |
} |
140 |
||
141 |
@Override |
|
142 |
public String getID() { |
|
143 |
return "exe"; |
|
144 |
} |
|
145 |
||
146 |
@Override |
|
147 |
public String getBundleType() { |
|
148 |
return "INSTALLER"; |
|
149 |
} |
|
150 |
||
151 |
@Override |
|
152 |
public Collection<BundlerParamInfo<?>> getBundleParameters() { |
|
153 |
Collection<BundlerParamInfo<?>> results = new LinkedHashSet<>(); |
|
154 |
results.addAll(WinAppBundler.getAppBundleParameters()); |
|
155 |
results.addAll(getExeBundleParameters()); |
|
156 |
return results; |
|
157 |
} |
|
158 |
||
159 |
public static Collection<BundlerParamInfo<?>> getExeBundleParameters() { |
|
160 |
return Arrays.asList( |
|
161 |
DESCRIPTION, |
|
162 |
COPYRIGHT, |
|
163 |
LICENSE_FILE, |
|
164 |
MENU_GROUP, |
|
165 |
MENU_HINT, |
|
166 |
SHORTCUT_HINT, |
|
167 |
EXE_SYSTEM_WIDE, |
|
168 |
VENDOR, |
|
169 |
INSTALLDIR_CHOOSER |
|
170 |
); |
|
171 |
} |
|
172 |
||
173 |
@Override |
|
57140 | 174 |
public File execute(Map<String, ? super Object> p, |
175 |
File outputParentDir) throws PackagerException { |
|
57038 | 176 |
return bundle(p, outputParentDir); |
177 |
} |
|
178 |
||
179 |
@Override |
|
57150 | 180 |
public boolean supported(boolean platformInstaller) { |
57038 | 181 |
return (Platform.getPlatform() == Platform.WINDOWS); |
182 |
} |
|
183 |
||
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
184 |
private static String findToolVersion(String toolName) { |
57038 | 185 |
try { |
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
186 |
if (toolName == null || "".equals(toolName)) return null; |
57038 | 187 |
|
188 |
ProcessBuilder pb = new ProcessBuilder( |
|
189 |
toolName, |
|
190 |
"/?"); |
|
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
191 |
VersionExtractor ve = |
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
192 |
new VersionExtractor("Inno Setup (\\d+.?\\d*)"); |
57038 | 193 |
IOUtils.exec(pb, Log.isDebug(), true, ve); |
194 |
// not interested in the output |
|
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
195 |
String version = ve.getVersion(); |
57038 | 196 |
Log.verbose(MessageFormat.format( |
197 |
getString("message.tool-version"), toolName, version)); |
|
198 |
return version; |
|
199 |
} catch (Exception e) { |
|
200 |
if (Log.isDebug()) { |
|
201 |
Log.verbose(e); |
|
202 |
} |
|
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
203 |
return null; |
57038 | 204 |
} |
205 |
} |
|
206 |
||
207 |
@Override |
|
208 |
public boolean validate(Map<String, ? super Object> p) |
|
209 |
throws UnsupportedPlatformException, ConfigException { |
|
210 |
try { |
|
211 |
if (p == null) throw new ConfigException( |
|
212 |
getString("error.parameters-null"), |
|
213 |
getString("error.parameters-null.advice")); |
|
214 |
||
215 |
// run basic validation to ensure requirements are met |
|
216 |
// we are not interested in return code, only possible exception |
|
217 |
APP_BUNDLER.fetchFrom(p).validate(p); |
|
218 |
||
219 |
// make sure some key values don't have newlines |
|
220 |
for (BundlerParamInfo<String> pi : Arrays.asList( |
|
221 |
APP_NAME, |
|
222 |
COPYRIGHT, |
|
223 |
DESCRIPTION, |
|
224 |
MENU_GROUP, |
|
225 |
VENDOR, |
|
226 |
VERSION) |
|
227 |
) { |
|
228 |
String v = pi.fetchFrom(p); |
|
229 |
if (v.contains("\n") | v.contains("\r")) { |
|
230 |
throw new ConfigException("Parmeter '" + pi.getID() + |
|
231 |
"' cannot contain a newline.", |
|
232 |
" Change the value of '" + pi.getID() + |
|
233 |
" so that it does not contain any newlines"); |
|
234 |
} |
|
235 |
} |
|
236 |
||
237 |
// exe bundlers trim the copyright to 100 characters, |
|
238 |
// tell them this will happen |
|
239 |
if (COPYRIGHT.fetchFrom(p).length() > 100) { |
|
240 |
throw new ConfigException( |
|
241 |
getString("error.copyright-is-too-long"), |
|
242 |
getString("error.copyright-is-too-long.advice")); |
|
243 |
} |
|
244 |
||
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
245 |
String innoVersion = findToolVersion( |
57038 | 246 |
TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p)); |
247 |
||
248 |
//Inno Setup 5+ is required |
|
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
249 |
String minVersion = "5.0"; |
57038 | 250 |
|
57219
bfa094e6ce15
8191709 : javapackager detects WiX 3.10 as 3.1 and fails to use WiX 3.6+ compatible code
herrick
parents:
57213
diff
changeset
|
251 |
if (VersionExtractor.isLessThan(innoVersion, minVersion)) { |
57038 | 252 |
Log.error(MessageFormat.format( |
253 |
getString("message.tool-wrong-version"), |
|
254 |
TOOL_INNO_SETUP_COMPILER, innoVersion, minVersion)); |
|
255 |
throw new ConfigException( |
|
256 |
getString("error.iscc-not-found"), |
|
257 |
getString("error.iscc-not-found.advice")); |
|
258 |
} |
|
259 |
||
260 |
/********* validate bundle parameters *************/ |
|
261 |
||
262 |
// only one mime type per association, at least one file extension |
|
263 |
List<Map<String, ? super Object>> associations = |
|
264 |
FILE_ASSOCIATIONS.fetchFrom(p); |
|
265 |
if (associations != null) { |
|
266 |
for (int i = 0; i < associations.size(); i++) { |
|
267 |
Map<String, ? super Object> assoc = associations.get(i); |
|
268 |
List<String> mimes = FA_CONTENT_TYPE.fetchFrom(assoc); |
|
269 |
if (mimes.size() > 1) { |
|
270 |
throw new ConfigException(MessageFormat.format( |
|
271 |
getString("error.too-many-content-" |
|
272 |
+ "types-for-file-association"), i), |
|
273 |
getString("error.too-many-content-" |
|
274 |
+ "types-for-file-association.advice")); |
|
275 |
} |
|
276 |
} |
|
277 |
} |
|
278 |
||
279 |
return true; |
|
280 |
} catch (RuntimeException re) { |
|
281 |
if (re.getCause() instanceof ConfigException) { |
|
282 |
throw (ConfigException) re.getCause(); |
|
283 |
} else { |
|
284 |
throw new ConfigException(re); |
|
285 |
} |
|
286 |
} |
|
287 |
} |
|
288 |
||
289 |
private boolean prepareProto(Map<String, ? super Object> p) |
|
57140 | 290 |
throws PackagerException, IOException { |
57038 | 291 |
File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
292 |
File appDir = null; |
|
293 |
||
294 |
// we either have an application image or need to build one |
|
295 |
if (appImage != null) { |
|
296 |
appDir = new File( |
|
297 |
EXE_IMAGE_DIR.fetchFrom(p), APP_NAME.fetchFrom(p)); |
|
298 |
// copy everything from appImage dir into appDir/name |
|
299 |
IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); |
|
300 |
} else { |
|
301 |
appDir = APP_BUNDLER.fetchFrom(p).doBundle(p, |
|
302 |
EXE_IMAGE_DIR.fetchFrom(p), true); |
|
303 |
} |
|
304 |
||
305 |
if (appDir == null) { |
|
306 |
return false; |
|
307 |
} |
|
308 |
||
309 |
p.put(WIN_APP_IMAGE.getID(), appDir); |
|
310 |
||
57080 | 311 |
String licenseFile = LICENSE_FILE.fetchFrom(p); |
312 |
if (licenseFile != null) { |
|
313 |
// need to copy license file to the working directory and convert to rtf if needed |
|
314 |
File lfile = new File(licenseFile); |
|
315 |
File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); |
|
316 |
IOUtils.copyFile(lfile, destFile); |
|
317 |
ensureByMutationFileIsRTF(destFile); |
|
57038 | 318 |
} |
319 |
||
320 |
// copy file association icons |
|
321 |
List<Map<String, ? super Object>> fileAssociations = |
|
322 |
FILE_ASSOCIATIONS.fetchFrom(p); |
|
323 |
||
324 |
for (Map<String, ? super Object> fa : fileAssociations) { |
|
325 |
File icon = FA_ICON.fetchFrom(fa); // TODO FA_ICON_ICO |
|
326 |
if (icon == null) { |
|
327 |
continue; |
|
328 |
} |
|
329 |
||
330 |
File faIconFile = new File(appDir, icon.getName()); |
|
331 |
||
332 |
if (icon.exists()) { |
|
333 |
try { |
|
334 |
IOUtils.copyFile(icon, faIconFile); |
|
335 |
} catch (IOException e) { |
|
57140 | 336 |
Log.verbose(e); |
57038 | 337 |
} |
338 |
} |
|
339 |
} |
|
340 |
||
341 |
return true; |
|
342 |
} |
|
343 |
||
57140 | 344 |
public File bundle(Map<String, ? super Object> p, File outdir) |
345 |
throws PackagerException { |
|
57038 | 346 |
if (!outdir.isDirectory() && !outdir.mkdirs()) { |
57140 | 347 |
throw new PackagerException("error.cannot-create-output-dir", |
348 |
outdir.getAbsolutePath()); |
|
57038 | 349 |
} |
350 |
if (!outdir.canWrite()) { |
|
57140 | 351 |
throw new PackagerException("error.cannot-write-to-output-dir", |
352 |
outdir.getAbsolutePath()); |
|
57038 | 353 |
} |
354 |
||
57151
38d0b67617e3
8217317: Create jpackage native library for windows
herrick
parents:
57150
diff
changeset
|
355 |
String tempDirectory = WindowsDefender.getUserTempDirectory(); |
38d0b67617e3
8217317: Create jpackage native library for windows
herrick
parents:
57150
diff
changeset
|
356 |
if (Arguments.CLIOptions.context().userProvidedBuildRoot) { |
57256 | 357 |
tempDirectory = TEMP_ROOT.fetchFrom(p).getAbsolutePath(); |
57151
38d0b67617e3
8217317: Create jpackage native library for windows
herrick
parents:
57150
diff
changeset
|
358 |
} |
38d0b67617e3
8217317: Create jpackage native library for windows
herrick
parents:
57150
diff
changeset
|
359 |
if (WindowsDefender.isThereAPotentialWindowsDefenderIssue( |
38d0b67617e3
8217317: Create jpackage native library for windows
herrick
parents:
57150
diff
changeset
|
360 |
tempDirectory)) { |
57038 | 361 |
Log.error(MessageFormat.format( |
362 |
getString("message.potential.windows.defender.issue"), |
|
57151
38d0b67617e3
8217317: Create jpackage native library for windows
herrick
parents:
57150
diff
changeset
|
363 |
tempDirectory)); |
57038 | 364 |
} |
365 |
||
366 |
// validate we have valid tools before continuing |
|
367 |
String iscc = TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p); |
|
368 |
if (iscc == null || !new File(iscc).isFile()) { |
|
57140 | 369 |
Log.verbose(getString("error.iscc-not-found")); |
370 |
Log.verbose(MessageFormat.format( |
|
57038 | 371 |
getString("message.iscc-file-string"), iscc)); |
57140 | 372 |
throw new PackagerException("error.iscc-not-found"); |
57038 | 373 |
} |
374 |
||
375 |
File imageDir = EXE_IMAGE_DIR.fetchFrom(p); |
|
376 |
try { |
|
377 |
imageDir.mkdirs(); |
|
378 |
||
379 |
boolean menuShortcut = MENU_HINT.fetchFrom(p); |
|
380 |
boolean desktopShortcut = SHORTCUT_HINT.fetchFrom(p); |
|
381 |
if (!menuShortcut && !desktopShortcut) { |
|
382 |
// both can not be false - user will not find the app |
|
383 |
Log.verbose(getString("message.one-shortcut-required")); |
|
384 |
p.put(MENU_HINT.getID(), true); |
|
385 |
} |
|
386 |
||
387 |
if (prepareProto(p) && prepareProjectConfig(p)) { |
|
388 |
File configScript = getConfig_Script(p); |
|
389 |
if (configScript.exists()) { |
|
390 |
Log.verbose(MessageFormat.format( |
|
391 |
getString("message.running-wsh-script"), |
|
392 |
configScript.getAbsolutePath())); |
|
393 |
IOUtils.run("wscript", configScript, VERBOSE.fetchFrom(p)); |
|
394 |
} |
|
395 |
return buildEXE(p, outdir); |
|
396 |
} |
|
397 |
return null; |
|
398 |
} catch (IOException ex) { |
|
57140 | 399 |
Log.verbose(ex); |
400 |
throw new PackagerException(ex); |
|
57038 | 401 |
} |
402 |
} |
|
403 |
||
404 |
// name of post-image script |
|
405 |
private File getConfig_Script(Map<String, ? super Object> p) { |
|
406 |
return new File(EXE_IMAGE_DIR.fetchFrom(p), |
|
407 |
APP_NAME.fetchFrom(p) + "-post-image.wsf"); |
|
408 |
} |
|
409 |
||
410 |
private String getAppIdentifier(Map<String, ? super Object> p) { |
|
57062
044e7a644ee3
8214575: Exe installers will install application to already existing instalation
herrick
parents:
57059
diff
changeset
|
411 |
String nm = UPGRADE_UUID.fetchFrom(p).toString(); |
57038 | 412 |
|
413 |
// limitation of innosetup |
|
414 |
if (nm.length() > 126) { |
|
415 |
Log.error(getString("message-truncating-id")); |
|
416 |
nm = nm.substring(0, 126); |
|
417 |
} |
|
418 |
||
419 |
return nm; |
|
420 |
} |
|
421 |
||
422 |
private String getLicenseFile(Map<String, ? super Object> p) { |
|
57080 | 423 |
String licenseFile = LICENSE_FILE.fetchFrom(p); |
424 |
if (licenseFile != null) { |
|
425 |
File lfile = new File(licenseFile); |
|
426 |
File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); |
|
427 |
String filePath = destFile.getAbsolutePath(); |
|
428 |
if (filePath.contains(" ")) { |
|
429 |
return "\"" + filePath + "\""; |
|
430 |
} else { |
|
431 |
return filePath; |
|
432 |
} |
|
57038 | 433 |
} |
57080 | 434 |
|
435 |
return null; |
|
57038 | 436 |
} |
437 |
||
438 |
void validateValueAndPut(Map<String, String> data, String key, |
|
439 |
BundlerParamInfo<String> param, |
|
440 |
Map<String, ? super Object> p) throws IOException { |
|
441 |
String value = param.fetchFrom(p); |
|
442 |
if (value.contains("\r") || value.contains("\n")) { |
|
443 |
throw new IOException("Configuration Parameter " + |
|
444 |
param.getID() + " cannot contain multiple lines of text"); |
|
445 |
} |
|
446 |
data.put(key, innosetupEscape(value)); |
|
447 |
} |
|
448 |
||
449 |
private String innosetupEscape(String value) { |
|
57080 | 450 |
if (value == null) { |
451 |
return ""; |
|
452 |
} |
|
453 |
||
57038 | 454 |
if (value.contains("\"") || !value.trim().equals(value)) { |
455 |
value = "\"" + value.replace("\"", "\"\"") + "\""; |
|
456 |
} |
|
457 |
return value; |
|
458 |
} |
|
459 |
||
460 |
boolean prepareMainProjectFile(Map<String, ? super Object> p) |
|
461 |
throws IOException { |
|
462 |
Map<String, String> data = new HashMap<>(); |
|
463 |
data.put("PRODUCT_APP_IDENTIFIER", |
|
464 |
innosetupEscape(getAppIdentifier(p))); |
|
465 |
||
466 |
||
467 |
validateValueAndPut(data, "INSTALLER_NAME", APP_NAME, p); |
|
468 |
validateValueAndPut(data, "APPLICATION_VENDOR", VENDOR, p); |
|
469 |
validateValueAndPut(data, "APPLICATION_VERSION", VERSION, p); |
|
470 |
validateValueAndPut(data, "INSTALLER_FILE_NAME", |
|
471 |
INSTALLER_FILE_NAME, p); |
|
472 |
||
473 |
data.put("LAUNCHER_NAME", |
|
474 |
innosetupEscape(WinAppBundler.getAppName(p))); |
|
475 |
||
476 |
data.put("APPLICATION_LAUNCHER_FILENAME", |
|
477 |
innosetupEscape(WinAppBundler.getLauncherName(p))); |
|
478 |
||
479 |
data.put("APPLICATION_DESKTOP_SHORTCUT", |
|
480 |
SHORTCUT_HINT.fetchFrom(p) ? "returnTrue" : "returnFalse"); |
|
481 |
data.put("APPLICATION_MENU_SHORTCUT", |
|
482 |
MENU_HINT.fetchFrom(p) ? "returnTrue" : "returnFalse"); |
|
483 |
validateValueAndPut(data, "APPLICATION_GROUP", MENU_GROUP, p); |
|
484 |
validateValueAndPut(data, "APPLICATION_COPYRIGHT", COPYRIGHT, p); |
|
485 |
||
486 |
data.put("APPLICATION_LICENSE_FILE", |
|
487 |
innosetupEscape(getLicenseFile(p))); |
|
488 |
data.put("DISABLE_DIR_PAGE", |
|
489 |
INSTALLDIR_CHOOSER.fetchFrom(p) ? "No" : "Yes"); |
|
490 |
||
491 |
Boolean isSystemWide = EXE_SYSTEM_WIDE.fetchFrom(p); |
|
492 |
||
493 |
if (isSystemWide) { |
|
494 |
data.put("APPLICATION_INSTALL_ROOT", "{pf}"); |
|
495 |
data.put("APPLICATION_INSTALL_PRIVILEGE", "admin"); |
|
496 |
} else { |
|
497 |
data.put("APPLICATION_INSTALL_ROOT", "{localappdata}"); |
|
498 |
data.put("APPLICATION_INSTALL_PRIVILEGE", "lowest"); |
|
499 |
} |
|
500 |
||
57213
8ff0a29bf9bc
8218055: Use ToolProvider instead of AppRuntimeImageBuilder.
herrick
parents:
57151
diff
changeset
|
501 |
data.put("ARCHITECTURE_BIT_MODE", "x64"); |
8ff0a29bf9bc
8218055: Use ToolProvider instead of AppRuntimeImageBuilder.
herrick
parents:
57151
diff
changeset
|
502 |
|
57038 | 503 |
validateValueAndPut(data, "RUN_FILENAME", APP_NAME, p); |
504 |
||
505 |
validateValueAndPut(data, "APPLICATION_DESCRIPTION", |
|
506 |
DESCRIPTION, p); |
|
507 |
||
508 |
data.put("APPLICATION_SERVICE", "returnFalse"); |
|
509 |
data.put("APPLICATION_NOT_SERVICE", "returnFalse"); |
|
510 |
data.put("APPLICATION_APP_CDS_INSTALL", "returnFalse"); |
|
511 |
data.put("START_ON_INSTALL", ""); |
|
512 |
data.put("STOP_ON_UNINSTALL", ""); |
|
513 |
data.put("RUN_AT_STARTUP", ""); |
|
514 |
||
57068
eb6d315c4e39
8215020: create-jre-installer exe fails when --runtime-image is specified.
herrick
parents:
57067
diff
changeset
|
515 |
String imagePathString = |
eb6d315c4e39
8215020: create-jre-installer exe fails when --runtime-image is specified.
herrick
parents:
57067
diff
changeset
|
516 |
WIN_APP_IMAGE.fetchFrom(p).toPath().toAbsolutePath().toString(); |
eb6d315c4e39
8215020: create-jre-installer exe fails when --runtime-image is specified.
herrick
parents:
57067
diff
changeset
|
517 |
data.put("APPLICATION_IMAGE", innosetupEscape(imagePathString)); |
eb6d315c4e39
8215020: create-jre-installer exe fails when --runtime-image is specified.
herrick
parents:
57067
diff
changeset
|
518 |
Log.verbose("setting APPLICATION_IMAGE to " + |
eb6d315c4e39
8215020: create-jre-installer exe fails when --runtime-image is specified.
herrick
parents:
57067
diff
changeset
|
519 |
innosetupEscape(imagePathString) + " for InnoSetup"); |
eb6d315c4e39
8215020: create-jre-installer exe fails when --runtime-image is specified.
herrick
parents:
57067
diff
changeset
|
520 |
|
57256 | 521 |
StringBuilder addLaunchersCfg = new StringBuilder(); |
57038 | 522 |
for (Map<String, ? super Object> |
57256 | 523 |
launcher : ADD_LAUNCHERS.fetchFrom(p)) { |
57038 | 524 |
String application_name = APP_NAME.fetchFrom(launcher); |
525 |
if (MENU_HINT.fetchFrom(launcher)) { |
|
526 |
// Name: "{group}\APPLICATION_NAME"; |
|
527 |
// Filename: "{app}\APPLICATION_NAME.exe"; |
|
528 |
// IconFilename: "{app}\APPLICATION_NAME.ico" |
|
57256 | 529 |
addLaunchersCfg.append("Name: \"{group}\\"); |
530 |
addLaunchersCfg.append(application_name); |
|
531 |
addLaunchersCfg.append("\"; Filename: \"{app}\\"); |
|
532 |
addLaunchersCfg.append(application_name); |
|
533 |
addLaunchersCfg.append(".exe\"; IconFilename: \"{app}\\"); |
|
534 |
addLaunchersCfg.append(application_name); |
|
535 |
addLaunchersCfg.append(".ico\"\r\n"); |
|
57038 | 536 |
} |
537 |
if (SHORTCUT_HINT.fetchFrom(launcher)) { |
|
538 |
// Name: "{commondesktop}\APPLICATION_NAME"; |
|
539 |
// Filename: "{app}\APPLICATION_NAME.exe"; |
|
540 |
// IconFilename: "{app}\APPLICATION_NAME.ico" |
|
57256 | 541 |
addLaunchersCfg.append("Name: \"{commondesktop}\\"); |
542 |
addLaunchersCfg.append(application_name); |
|
543 |
addLaunchersCfg.append("\"; Filename: \"{app}\\"); |
|
544 |
addLaunchersCfg.append(application_name); |
|
545 |
addLaunchersCfg.append(".exe\"; IconFilename: \"{app}\\"); |
|
546 |
addLaunchersCfg.append(application_name); |
|
547 |
addLaunchersCfg.append(".ico\"\r\n"); |
|
57038 | 548 |
} |
549 |
} |
|
57256 | 550 |
data.put("ADD_LAUNCHERS", addLaunchersCfg.toString()); |
57038 | 551 |
|
552 |
StringBuilder registryEntries = new StringBuilder(); |
|
553 |
String regName = APP_REGISTRY_NAME.fetchFrom(p); |
|
554 |
List<Map<String, ? super Object>> fetchFrom = |
|
555 |
FILE_ASSOCIATIONS.fetchFrom(p); |
|
556 |
for (int i = 0; i < fetchFrom.size(); i++) { |
|
557 |
Map<String, ? super Object> fileAssociation = fetchFrom.get(i); |
|
558 |
String description = FA_DESCRIPTION.fetchFrom(fileAssociation); |
|
559 |
File icon = FA_ICON.fetchFrom(fileAssociation); //TODO FA_ICON_ICO |
|
560 |
||
561 |
List<String> extensions = FA_EXTENSIONS.fetchFrom(fileAssociation); |
|
562 |
String entryName = regName + "File"; |
|
563 |
if (i > 0) { |
|
564 |
entryName += "." + i; |
|
565 |
} |
|
566 |
||
567 |
if (extensions == null) { |
|
568 |
Log.verbose(getString( |
|
569 |
"message.creating-association-with-null-extension")); |
|
570 |
} else { |
|
571 |
for (String ext : extensions) { |
|
572 |
if (isSystemWide) { |
|
573 |
// "Root: HKCR; Subkey: \".myp\"; |
|
574 |
// ValueType: string; ValueName: \"\"; |
|
575 |
// ValueData: \"MyProgramFile\"; |
|
576 |
// Flags: uninsdeletevalue" |
|
577 |
registryEntries.append("Root: HKCR; Subkey: \".") |
|
578 |
.append(ext) |
|
579 |
.append("\"; ValueType: string;" |
|
580 |
+ " ValueName: \"\"; ValueData: \"") |
|
581 |
.append(entryName) |
|
57080 | 582 |
.append("\"; Flags: uninsdeletevalue uninsdeletekeyifempty\r\n"); |
57038 | 583 |
} else { |
584 |
registryEntries.append( |
|
585 |
"Root: HKCU; Subkey: \"Software\\Classes\\.") |
|
586 |
.append(ext) |
|
587 |
.append("\"; ValueType: string;" |
|
588 |
+ " ValueName: \"\"; ValueData: \"") |
|
589 |
.append(entryName) |
|
57080 | 590 |
.append("\"; Flags: uninsdeletevalue uninsdeletekeyifempty\r\n"); |
57038 | 591 |
} |
592 |
} |
|
593 |
} |
|
594 |
||
595 |
if (extensions != null && !extensions.isEmpty()) { |
|
596 |
String ext = extensions.get(0); |
|
597 |
List<String> mimeTypes = |
|
598 |
FA_CONTENT_TYPE.fetchFrom(fileAssociation); |
|
599 |
for (String mime : mimeTypes) { |
|
600 |
if (isSystemWide) { |
|
601 |
// "Root: HKCR; |
|
602 |
// Subkey: HKCR\\Mime\\Database\\ |
|
603 |
// Content Type\\application/chaos; |
|
604 |
// ValueType: string; |
|
605 |
// ValueName: Extension; |
|
606 |
// ValueData: .chaos; |
|
607 |
// Flags: uninsdeletevalue" |
|
608 |
registryEntries.append("Root: HKCR; Subkey: " + |
|
609 |
"\"Mime\\Database\\Content Type\\") |
|
610 |
.append(mime) |
|
611 |
.append("\"; ValueType: string; ValueName: " + |
|
612 |
"\"Extension\"; ValueData: \".") |
|
613 |
.append(ext) |
|
57080 | 614 |
.append("\"; Flags: uninsdeletevalue uninsdeletekeyifempty\r\n"); |
57038 | 615 |
} else { |
616 |
registryEntries.append( |
|
617 |
"Root: HKCU; Subkey: \"Software\\" + |
|
618 |
"Classes\\Mime\\Database\\Content Type\\") |
|
619 |
.append(mime) |
|
620 |
.append("\"; ValueType: string; " + |
|
621 |
"ValueName: \"Extension\"; ValueData: \".") |
|
622 |
.append(ext) |
|
57080 | 623 |
.append("\"; Flags: uninsdeletevalue uninsdeletekeyifempty\r\n"); |
57038 | 624 |
} |
625 |
} |
|
626 |
} |
|
627 |
||
628 |
if (isSystemWide) { |
|
629 |
// "Root: HKCR; |
|
630 |
// Subkey: \"MyProgramFile\"; |
|
631 |
// ValueType: string; |
|
632 |
// ValueName: \"\"; |
|
633 |
// ValueData: \"My Program File\"; |
|
634 |
// Flags: uninsdeletekey" |
|
635 |
registryEntries.append("Root: HKCR; Subkey: \"") |
|
636 |
.append(entryName) |
|
637 |
.append( |
|
638 |
"\"; ValueType: string; ValueName: \"\"; ValueData: \"") |
|
639 |
.append(removeQuotes(description)) |
|
640 |
.append("\"; Flags: uninsdeletekey\r\n"); |
|
641 |
} else { |
|
642 |
registryEntries.append( |
|
643 |
"Root: HKCU; Subkey: \"Software\\Classes\\") |
|
644 |
.append(entryName) |
|
645 |
.append( |
|
646 |
"\"; ValueType: string; ValueName: \"\"; ValueData: \"") |
|
647 |
.append(removeQuotes(description)) |
|
648 |
.append("\"; Flags: uninsdeletekey\r\n"); |
|
649 |
} |
|
650 |
||
651 |
if (icon != null && icon.exists()) { |
|
652 |
if (isSystemWide) { |
|
653 |
// "Root: HKCR; |
|
654 |
// Subkey: \"MyProgramFile\\DefaultIcon\"; |
|
655 |
// ValueType: string; |
|
656 |
// ValueName: \"\"; |
|
657 |
// ValueData: \"{app}\\MYPROG.EXE,0\"\n" + |
|
658 |
registryEntries.append("Root: HKCR; Subkey: \"") |
|
659 |
.append(entryName) |
|
660 |
.append("\\DefaultIcon\"; ValueType: string; " + |
|
661 |
"ValueName: \"\"; ValueData: \"{app}\\") |
|
662 |
.append(icon.getName()) |
|
663 |
.append("\"\r\n"); |
|
664 |
} else { |
|
665 |
registryEntries.append( |
|
666 |
"Root: HKCU; Subkey: \"Software\\Classes\\") |
|
667 |
.append(entryName) |
|
668 |
.append("\\DefaultIcon\"; ValueType: string; " + |
|
669 |
"ValueName: \"\"; ValueData: \"{app}\\") |
|
670 |
.append(icon.getName()) |
|
671 |
.append("\"\r\n"); |
|
672 |
} |
|
673 |
} |
|
674 |
||
675 |
if (isSystemWide) { |
|
676 |
// "Root: HKCR; |
|
677 |
// Subkey: \"MyProgramFile\\shell\\open\\command\"; |
|
678 |
// ValueType: string; |
|
679 |
// ValueName: \"\"; |
|
680 |
// ValueData: \"\"\"{app}\\MYPROG.EXE\"\" \"\"%1\"\"\"\n" |
|
681 |
registryEntries.append("Root: HKCR; Subkey: \"") |
|
682 |
.append(entryName) |
|
683 |
.append("\\shell\\open\\command\"; ValueType: " + |
|
684 |
"string; ValueName: \"\"; ValueData: \"\"\"{app}\\") |
|
685 |
.append(APP_NAME.fetchFrom(p)) |
|
686 |
.append("\"\" \"\"%1\"\"\"\r\n"); |
|
687 |
} else { |
|
688 |
registryEntries.append( |
|
689 |
"Root: HKCU; Subkey: \"Software\\Classes\\") |
|
690 |
.append(entryName) |
|
691 |
.append("\\shell\\open\\command\"; ValueType: " + |
|
692 |
"string; ValueName: \"\"; ValueData: \"\"\"{app}\\") |
|
693 |
.append(APP_NAME.fetchFrom(p)) |
|
694 |
.append("\"\" \"\"%1\"\"\"\r\n"); |
|
695 |
} |
|
696 |
} |
|
697 |
if (registryEntries.length() > 0) { |
|
698 |
data.put("FILE_ASSOCIATIONS", |
|
699 |
"ChangesAssociations=yes\r\n\r\n[Registry]\r\n" + |
|
700 |
registryEntries.toString()); |
|
701 |
} else { |
|
702 |
data.put("FILE_ASSOCIATIONS", ""); |
|
703 |
} |
|
704 |
||
57256 | 705 |
String iss = StandardBundlerParam.isRuntimeInstaller(p) ? |
57038 | 706 |
DEFAULT_JRE_EXE_TEMPLATE : DEFAULT_EXE_PROJECT_TEMPLATE; |
707 |
||
708 |
Writer w = new BufferedWriter(new FileWriter( |
|
709 |
getConfig_ExeProjectFile(p))); |
|
710 |
||
711 |
String content = preprocessTextResource( |
|
712 |
getConfig_ExeProjectFile(p).getName(), |
|
713 |
getString("resource.inno-setup-project-file"), |
|
714 |
iss, data, VERBOSE.fetchFrom(p), |
|
57091
06bc4bd64599
8215515: Add a command line option to override internal resources.
herrick
parents:
57080
diff
changeset
|
715 |
RESOURCE_DIR.fetchFrom(p)); |
57038 | 716 |
w.write(content); |
717 |
w.close(); |
|
718 |
return true; |
|
719 |
} |
|
720 |
||
721 |
private final static String removeQuotes(String s) { |
|
722 |
if (s.length() > 2 && s.startsWith("\"") && s.endsWith("\"")) { |
|
723 |
// special case for '"XXX"' return 'XXX' not '-XXX-' |
|
724 |
// note '"' and '""' are excluded from this special case |
|
725 |
s = s.substring(1, s.length() - 1); |
|
726 |
} |
|
727 |
// if there interior double quotes replace them with '-' |
|
728 |
return s.replaceAll("\"", "-"); |
|
729 |
} |
|
730 |
||
731 |
private final static String DEFAULT_INNO_SETUP_ICON = |
|
732 |
"icon_inno_setup.bmp"; |
|
733 |
||
734 |
private boolean prepareProjectConfig(Map<String, ? super Object> p) |
|
735 |
throws IOException { |
|
736 |
prepareMainProjectFile(p); |
|
737 |
||
738 |
// prepare installer icon |
|
739 |
File iconTarget = getConfig_SmallInnoSetupIcon(p); |
|
57091
06bc4bd64599
8215515: Add a command line option to override internal resources.
herrick
parents:
57080
diff
changeset
|
740 |
fetchResource(iconTarget.getName(), |
57038 | 741 |
getString("resource.setup-icon"), |
742 |
DEFAULT_INNO_SETUP_ICON, |
|
743 |
iconTarget, |
|
744 |
VERBOSE.fetchFrom(p), |
|
57091
06bc4bd64599
8215515: Add a command line option to override internal resources.
herrick
parents:
57080
diff
changeset
|
745 |
RESOURCE_DIR.fetchFrom(p)); |
57038 | 746 |
|
57091
06bc4bd64599
8215515: Add a command line option to override internal resources.
herrick
parents:
57080
diff
changeset
|
747 |
fetchResource(getConfig_Script(p).getName(), |
57038 | 748 |
getString("resource.post-install-script"), |
749 |
(String) null, |
|
750 |
getConfig_Script(p), |
|
751 |
VERBOSE.fetchFrom(p), |
|
57091
06bc4bd64599
8215515: Add a command line option to override internal resources.
herrick
parents:
57080
diff
changeset
|
752 |
RESOURCE_DIR.fetchFrom(p)); |
57038 | 753 |
return true; |
754 |
} |
|
755 |
||
756 |
private File getConfig_SmallInnoSetupIcon( |
|
757 |
Map<String, ? super Object> p) { |
|
758 |
return new File(EXE_IMAGE_DIR.fetchFrom(p), |
|
759 |
APP_NAME.fetchFrom(p) + "-setup-icon.bmp"); |
|
760 |
} |
|
761 |
||
762 |
private File getConfig_ExeProjectFile(Map<String, ? super Object> p) { |
|
763 |
return new File(EXE_IMAGE_DIR.fetchFrom(p), |
|
764 |
APP_NAME.fetchFrom(p) + ".iss"); |
|
765 |
} |
|
766 |
||
767 |
||
768 |
private File buildEXE(Map<String, ? super Object> p, File outdir) |
|
769 |
throws IOException { |
|
770 |
Log.verbose(MessageFormat.format( |
|
771 |
getString("message.outputting-to-location"), |
|
772 |
outdir.getAbsolutePath())); |
|
773 |
||
774 |
outdir.mkdirs(); |
|
775 |
||
776 |
// run Inno Setup |
|
777 |
ProcessBuilder pb = new ProcessBuilder( |
|
778 |
TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p), |
|
779 |
"/q", // turn off inno setup output |
|
780 |
"/o"+outdir.getAbsolutePath(), |
|
781 |
getConfig_ExeProjectFile(p).getAbsolutePath()); |
|
782 |
pb = pb.directory(EXE_IMAGE_DIR.fetchFrom(p)); |
|
783 |
IOUtils.exec(pb, VERBOSE.fetchFrom(p)); |
|
784 |
||
785 |
Log.verbose(MessageFormat.format( |
|
786 |
getString("message.output-location"), |
|
787 |
outdir.getAbsolutePath())); |
|
788 |
||
789 |
// presume the result is the ".exe" file with the newest modified time |
|
790 |
// not the best solution, but it is the most reliable |
|
791 |
File result = null; |
|
792 |
long lastModified = 0; |
|
793 |
File[] list = outdir.listFiles(); |
|
794 |
if (list != null) { |
|
795 |
for (File f : list) { |
|
796 |
if (f.getName().endsWith(".exe") && |
|
797 |
f.lastModified() > lastModified) { |
|
798 |
result = f; |
|
799 |
lastModified = f.lastModified(); |
|
800 |
} |
|
801 |
} |
|
802 |
} |
|
803 |
||
804 |
return result; |
|
805 |
} |
|
806 |
||
807 |
public static void ensureByMutationFileIsRTF(File f) { |
|
808 |
if (f == null || !f.isFile()) return; |
|
809 |
||
810 |
try { |
|
811 |
boolean existingLicenseIsRTF = false; |
|
812 |
||
813 |
try (FileInputStream fin = new FileInputStream(f)) { |
|
814 |
byte[] firstBits = new byte[7]; |
|
815 |
||
816 |
if (fin.read(firstBits) == firstBits.length) { |
|
817 |
String header = new String(firstBits); |
|
818 |
existingLicenseIsRTF = "{\\rtf1\\".equals(header); |
|
819 |
} |
|
820 |
} |
|
821 |
||
822 |
if (!existingLicenseIsRTF) { |
|
823 |
List<String> oldLicense = Files.readAllLines(f.toPath()); |
|
824 |
try (Writer w = Files.newBufferedWriter( |
|
825 |
f.toPath(), Charset.forName("Windows-1252"))) { |
|
826 |
w.write("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033" |
|
827 |
+ "{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}}\n" |
|
828 |
+ "\\viewkind4\\uc1\\pard\\sa200\\sl276" |
|
829 |
+ "\\slmult1\\lang9\\fs20 "); |
|
830 |
oldLicense.forEach(l -> { |
|
831 |
try { |
|
832 |
for (char c : l.toCharArray()) { |
|
833 |
if (c < 0x10) { |
|
834 |
w.write("\\'0"); |
|
835 |
w.write(Integer.toHexString(c)); |
|
836 |
} else if (c > 0xff) { |
|
837 |
w.write("\\ud"); |
|
838 |
w.write(Integer.toString(c)); |
|
839 |
w.write("?"); |
|
840 |
} else if ((c < 0x20) || (c >= 0x80) || |
|
841 |
(c == 0x5C) || (c == 0x7B) || |
|
842 |
(c == 0x7D)) { |
|
843 |
w.write("\\'"); |
|
844 |
w.write(Integer.toHexString(c)); |
|
845 |
} else { |
|
846 |
w.write(c); |
|
847 |
} |
|
848 |
} |
|
849 |
if (l.length() < 1) { |
|
850 |
w.write("\\par"); |
|
851 |
} else { |
|
852 |
w.write(" "); |
|
853 |
} |
|
854 |
w.write("\r\n"); |
|
855 |
} catch (IOException e) { |
|
856 |
Log.verbose(e); |
|
857 |
} |
|
858 |
}); |
|
859 |
w.write("}\r\n"); |
|
860 |
} |
|
861 |
} |
|
862 |
} catch (IOException e) { |
|
863 |
Log.verbose(e); |
|
864 |
} |
|
865 |
} |
|
866 |
||
867 |
private static String getString(String key) |
|
868 |
throws MissingResourceException { |
|
869 |
return I18N.getString(key); |
|
870 |
} |
|
871 |
} |