112 versionCtnr[0] = firstLineOfOutput.substring(separatorIdx + 1); |
112 versionCtnr[0] = firstLineOfOutput.substring(separatorIdx + 1); |
113 return versionCtnr[0]; |
113 return versionCtnr[0]; |
114 })::validate; |
114 })::validate; |
115 } |
115 } |
116 |
116 |
117 private final static String MINIMAL_VERSION = "3.0"; |
117 private final static DottedVersion MINIMAL_VERSION = DottedVersion.lazy("3.0"); |
118 |
118 |
119 static Path getSystemDir(String envVar, String knownDir) { |
119 static Path getSystemDir(String envVar, String knownDir) { |
120 return Optional |
120 return Optional |
121 .ofNullable(getEnvVariableAsPath(envVar)) |
121 .ofNullable(getEnvVariableAsPath(envVar)) |
122 .orElseGet(() -> Optional |
122 .orElseGet(() -> Optional |
130 try { |
130 try { |
131 return Path.of(path); |
131 return Path.of(path); |
132 } catch (InvalidPathException ex) { |
132 } catch (InvalidPathException ex) { |
133 Log.error(MessageFormat.format(I18N.getString( |
133 Log.error(MessageFormat.format(I18N.getString( |
134 "error.invalid-envvar"), envVar)); |
134 "error.invalid-envvar"), envVar)); |
135 return null; |
|
136 } |
135 } |
137 } |
136 } |
138 return null; |
137 return null; |
139 } |
138 } |
140 |
139 |
141 private static List<Path> findWixInstallDirs() { |
140 private static List<Path> findWixInstallDirs() { |
142 PathMatcher wixInstallDirMatcher = FileSystems.getDefault().getPathMatcher( |
141 PathMatcher wixInstallDirMatcher = FileSystems.getDefault().getPathMatcher( |
143 "glob:WiX Toolset v*"); |
142 "glob:WiX Toolset v*"); |
144 |
143 |
145 Path programFiles = getSystemDir("ProgramFiles", "Program Files"); |
144 Path programFiles = getSystemDir("ProgramFiles", "\\Program Files"); |
146 Path programFilesX86 = getSystemDir("ProgramFiles(X86)", |
145 Path programFilesX86 = getSystemDir("ProgramFiles(x86)", |
147 "Program Files (x86)"); |
146 "\\Program Files (x86)"); |
148 |
147 |
149 // Returns list of WiX install directories ordered by WiX version number. |
148 // Returns list of WiX install directories ordered by WiX version number. |
150 // Newer versions go first. |
149 // Newer versions go first. |
151 return Stream.of(programFiles, programFilesX86).map(path -> { |
150 return Stream.of(programFiles, programFilesX86).map(path -> { |
152 List<Path> result; |
151 List<Path> result; |