--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FileAssociations.java Fri Oct 18 11:00:57 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FileAssociations.java Fri Oct 18 14:14:37 2019 -0400
@@ -23,10 +23,11 @@
package jdk.jpackage.test;
import java.nio.file.Path;
+import java.util.HashMap;
import java.util.Map;
-public class FileAssociations {
+final public class FileAssociations {
public FileAssociations(String faSuffixName) {
suffixName = faSuffixName;
setFilename("fa");
@@ -34,22 +35,36 @@
}
public void createFile() {
- TKit.createPropertiesFile(file,
- Map.entry("extension", suffixName),
- Map.entry("mime-type", getMime()),
- Map.entry("description", description));
+ Map<String, String> entries = new HashMap<>(Map.of(
+ "extension", suffixName,
+ "mime-type", getMime(),
+ "description", description
+ ));
+ if (icon != null) {
+ if (TKit.isWindows()) {
+ entries.put("icon", icon.toString().replace("\\", "/"));
+ } else {
+ entries.put("icon", icon.toString());
+ }
+ }
+ TKit.createPropertiesFile(file, entries);
}
- final public FileAssociations setFilename(String v) {
+ public FileAssociations setFilename(String v) {
file = TKit.workDir().resolve(v + ".properties");
return this;
}
- final public FileAssociations setDescription(String v) {
+ public FileAssociations setDescription(String v) {
description = v;
return this;
}
+ public FileAssociations setIcon(Path v) {
+ icon = v;
+ return this;
+ }
+
public Path getPropertiesFile() {
return file;
}
@@ -65,4 +80,5 @@
private Path file;
final private String suffixName;
private String description;
+ private Path icon;
}