1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static java.awt.event.InputEvent.ALT_DOWN_MASK;
|
---|
5 | import static java.awt.event.InputEvent.CTRL_DOWN_MASK;
|
---|
6 | import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
|
---|
7 | import static java.awt.event.KeyEvent.VK_A;
|
---|
8 | import static java.awt.event.KeyEvent.VK_C;
|
---|
9 | import static java.awt.event.KeyEvent.VK_D;
|
---|
10 | import static java.awt.event.KeyEvent.VK_DELETE;
|
---|
11 | import static java.awt.event.KeyEvent.VK_DOWN;
|
---|
12 | import static java.awt.event.KeyEvent.VK_ENTER;
|
---|
13 | import static java.awt.event.KeyEvent.VK_ESCAPE;
|
---|
14 | import static java.awt.event.KeyEvent.VK_F10;
|
---|
15 | import static java.awt.event.KeyEvent.VK_F4;
|
---|
16 | import static java.awt.event.KeyEvent.VK_LEFT;
|
---|
17 | import static java.awt.event.KeyEvent.VK_NUM_LOCK;
|
---|
18 | import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
|
---|
19 | import static java.awt.event.KeyEvent.VK_RIGHT;
|
---|
20 | import static java.awt.event.KeyEvent.VK_SHIFT;
|
---|
21 | import static java.awt.event.KeyEvent.VK_SPACE;
|
---|
22 | import static java.awt.event.KeyEvent.VK_TAB;
|
---|
23 | import static java.awt.event.KeyEvent.VK_UP;
|
---|
24 | import static java.awt.event.KeyEvent.VK_V;
|
---|
25 | import static java.awt.event.KeyEvent.VK_X;
|
---|
26 | import static java.awt.event.KeyEvent.VK_Y;
|
---|
27 | import static java.awt.event.KeyEvent.VK_Z;
|
---|
28 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
29 | import static org.openstreetmap.josm.tools.Utils.getSystemEnv;
|
---|
30 | import static org.openstreetmap.josm.tools.Utils.getSystemProperty;
|
---|
31 | import static org.openstreetmap.josm.tools.WinRegistry.HKEY_LOCAL_MACHINE;
|
---|
32 |
|
---|
33 | import java.awt.Desktop;
|
---|
34 | import java.io.BufferedWriter;
|
---|
35 | import java.io.File;
|
---|
36 | import java.io.IOException;
|
---|
37 | import java.io.InputStream;
|
---|
38 | import java.io.OutputStream;
|
---|
39 | import java.io.OutputStreamWriter;
|
---|
40 | import java.io.Writer;
|
---|
41 | import java.lang.reflect.InvocationTargetException;
|
---|
42 | import java.net.URI;
|
---|
43 | import java.net.URISyntaxException;
|
---|
44 | import java.nio.charset.StandardCharsets;
|
---|
45 | import java.nio.file.DirectoryIteratorException;
|
---|
46 | import java.nio.file.DirectoryStream;
|
---|
47 | import java.nio.file.FileSystems;
|
---|
48 | import java.nio.file.Files;
|
---|
49 | import java.nio.file.InvalidPathException;
|
---|
50 | import java.nio.file.Path;
|
---|
51 | import java.security.KeyStore;
|
---|
52 | import java.security.KeyStoreException;
|
---|
53 | import java.security.MessageDigest;
|
---|
54 | import java.security.NoSuchAlgorithmException;
|
---|
55 | import java.security.cert.Certificate;
|
---|
56 | import java.security.cert.CertificateException;
|
---|
57 | import java.security.cert.X509Certificate;
|
---|
58 | import java.text.ParseException;
|
---|
59 | import java.util.ArrayList;
|
---|
60 | import java.util.Arrays;
|
---|
61 | import java.util.Collection;
|
---|
62 | import java.util.Enumeration;
|
---|
63 | import java.util.HashSet;
|
---|
64 | import java.util.List;
|
---|
65 | import java.util.Locale;
|
---|
66 | import java.util.Properties;
|
---|
67 | import java.util.Set;
|
---|
68 | import java.util.concurrent.ExecutionException;
|
---|
69 | import java.util.concurrent.TimeUnit;
|
---|
70 | import java.util.regex.Matcher;
|
---|
71 | import java.util.regex.Pattern;
|
---|
72 |
|
---|
73 | import org.openstreetmap.josm.data.Preferences;
|
---|
74 | import org.openstreetmap.josm.data.StructUtils;
|
---|
75 | import org.openstreetmap.josm.data.StructUtils.StructEntry;
|
---|
76 | import org.openstreetmap.josm.data.StructUtils.WriteExplicitly;
|
---|
77 | import org.openstreetmap.josm.io.CertificateAmendment.NativeCertAmend;
|
---|
78 | import org.openstreetmap.josm.io.NetworkManager;
|
---|
79 | import org.openstreetmap.josm.io.OnlineResource;
|
---|
80 | import org.openstreetmap.josm.spi.preferences.Config;
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * {@code PlatformHook} implementation for Microsoft Windows systems.
|
---|
84 | * @since 1023
|
---|
85 | */
|
---|
86 | public class PlatformHookWindows implements PlatformHook {
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Pattern of Microsoft .NET and Powershell version numbers in registry.
|
---|
90 | */
|
---|
91 | private static final Pattern MS_VERSION_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)(\\.\\d+.*)?");
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Simple data class to hold information about a font.
|
---|
95 | *
|
---|
96 | * Used for fontconfig.properties files.
|
---|
97 | */
|
---|
98 | public static class FontEntry {
|
---|
99 | /**
|
---|
100 | * The character subset. Basically a free identifier, but should be unique.
|
---|
101 | */
|
---|
102 | @StructEntry
|
---|
103 | public String charset;
|
---|
104 |
|
---|
105 | /**
|
---|
106 | * Platform font name.
|
---|
107 | */
|
---|
108 | @StructEntry
|
---|
109 | @WriteExplicitly
|
---|
110 | public String name = "";
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * File name.
|
---|
114 | */
|
---|
115 | @StructEntry
|
---|
116 | @WriteExplicitly
|
---|
117 | public String file = "";
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Constructs a new {@code FontEntry}.
|
---|
121 | */
|
---|
122 | public FontEntry() {
|
---|
123 | // Default constructor needed for construction by reflection
|
---|
124 | }
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Constructs a new {@code FontEntry}.
|
---|
128 | * @param charset The character subset. Basically a free identifier, but should be unique
|
---|
129 | * @param name Platform font name
|
---|
130 | * @param file File name
|
---|
131 | */
|
---|
132 | public FontEntry(String charset, String name, String file) {
|
---|
133 | this.charset = charset;
|
---|
134 | this.name = name;
|
---|
135 | this.file = file;
|
---|
136 | }
|
---|
137 | }
|
---|
138 |
|
---|
139 | private static final String WINDOWS_ROOT = "Windows-ROOT";
|
---|
140 |
|
---|
141 | private static final String CURRENT_VERSION = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
---|
142 |
|
---|
143 | private String oSBuildNumber;
|
---|
144 |
|
---|
145 | @Override
|
---|
146 | public Platform getPlatform() {
|
---|
147 | return Platform.WINDOWS;
|
---|
148 | }
|
---|
149 |
|
---|
150 | @Override
|
---|
151 | public void afterPrefStartupHook() {
|
---|
152 | extendFontconfig("fontconfig.properties.src");
|
---|
153 | }
|
---|
154 |
|
---|
155 | @Override
|
---|
156 | public void startupHook(JavaExpirationCallback callback) {
|
---|
157 | checkExpiredJava(callback);
|
---|
158 | }
|
---|
159 |
|
---|
160 | @Override
|
---|
161 | public void openUrl(String url) throws IOException {
|
---|
162 | if (!url.startsWith("file:/")) {
|
---|
163 | final String customBrowser = Config.getPref().get("browser.windows", "");
|
---|
164 | if (!customBrowser.isEmpty()) {
|
---|
165 | Runtime.getRuntime().exec(new String[]{customBrowser, url});
|
---|
166 | return;
|
---|
167 | }
|
---|
168 | }
|
---|
169 | try {
|
---|
170 | // Desktop API works fine under Windows
|
---|
171 | Desktop.getDesktop().browse(new URI(url));
|
---|
172 | } catch (IOException | URISyntaxException e) {
|
---|
173 | Logging.log(Logging.LEVEL_WARN, "Desktop class failed. Platform dependent fall back for open url in browser.", e);
|
---|
174 | Runtime.getRuntime().exec(new String[]{"rundll32", "url.dll,FileProtocolHandler", url});
|
---|
175 | }
|
---|
176 | }
|
---|
177 |
|
---|
178 | @Override
|
---|
179 | public void initSystemShortcuts() {
|
---|
180 | // CHECKSTYLE.OFF: LineLength
|
---|
181 | //Shortcut.registerSystemCut("system:menuexit", tr("reserved"), VK_Q, CTRL_DOWN_MASK);
|
---|
182 | Shortcut.registerSystemShortcut("system:duplicate", tr("reserved"), VK_D, CTRL_DOWN_MASK); // not really system, but to avoid odd results
|
---|
183 |
|
---|
184 | // Windows 7 shortcuts: http://windows.microsoft.com/en-US/windows7/Keyboard-shortcuts
|
---|
185 |
|
---|
186 | // Shortcuts with setAutomatic(): items with automatic shortcuts will not be added to the menu bar at all
|
---|
187 |
|
---|
188 | // Don't know why Ctrl-Alt-Del isn't even listed on official Microsoft support page
|
---|
189 | Shortcut.registerSystemShortcut("system:reset", tr("reserved"), VK_DELETE, CTRL_DOWN_MASK | ALT_DOWN_MASK).setAutomatic();
|
---|
190 |
|
---|
191 | // Ease of Access keyboard shortcuts
|
---|
192 | Shortcut.registerSystemShortcut("microsoft-reserved-01", tr("reserved"), VK_PRINTSCREEN, ALT_DOWN_MASK | SHIFT_DOWN_MASK).setAutomatic(); // Turn High Contrast on or off
|
---|
193 | Shortcut.registerSystemShortcut("microsoft-reserved-02", tr("reserved"), VK_NUM_LOCK, ALT_DOWN_MASK | SHIFT_DOWN_MASK).setAutomatic(); // Turn Mouse Keys on or off
|
---|
194 | //Shortcut.registerSystemCut("microsoft-reserved-03", tr("reserved"), VK_U, );// Open the Ease of Access Center (TODO: Windows-U, how to handle it in Java ?)
|
---|
195 |
|
---|
196 | // General keyboard shortcuts
|
---|
197 | //Shortcut.registerSystemShortcut("system:help", tr("reserved"), VK_F1, 0); // Display Help
|
---|
198 | Shortcut.registerSystemShortcut("system:copy", tr("reserved"), VK_C, CTRL_DOWN_MASK); // Copy the selected item
|
---|
199 | Shortcut.registerSystemShortcut("system:cut", tr("reserved"), VK_X, CTRL_DOWN_MASK); // Cut the selected item
|
---|
200 | Shortcut.registerSystemShortcut("system:paste", tr("reserved"), VK_V, CTRL_DOWN_MASK); // Paste the selected item
|
---|
201 | Shortcut.registerSystemShortcut("system:undo", tr("reserved"), VK_Z, CTRL_DOWN_MASK); // Undo an action
|
---|
202 | Shortcut.registerSystemShortcut("system:redo", tr("reserved"), VK_Y, CTRL_DOWN_MASK); // Redo an action
|
---|
203 | //Shortcut.registerSystemCut("microsoft-reserved-10", tr("reserved"), VK_DELETE, 0); // Delete the selected item and move it to the Recycle Bin
|
---|
204 | //Shortcut.registerSystemCut("microsoft-reserved-11", tr("reserved"), VK_DELETE, SHIFT_DOWN_MASK); // Delete the selected item without moving it to the Recycle Bin first
|
---|
205 | //Shortcut.registerSystemCut("system:rename", tr("reserved"), VK_F2, 0); // Rename the selected item
|
---|
206 | Shortcut.registerSystemShortcut("system:movefocusright", tr("reserved"), VK_RIGHT, CTRL_DOWN_MASK); // Move the cursor to the beginning of the next word
|
---|
207 | Shortcut.registerSystemShortcut("system:movefocusleft", tr("reserved"), VK_LEFT, CTRL_DOWN_MASK); // Move the cursor to the beginning of the previous word
|
---|
208 | Shortcut.registerSystemShortcut("system:movefocusdown", tr("reserved"), VK_DOWN, CTRL_DOWN_MASK); // Move the cursor to the beginning of the next paragraph
|
---|
209 | Shortcut.registerSystemShortcut("system:movefocusup", tr("reserved"), VK_UP, CTRL_DOWN_MASK); // Move the cursor to the beginning of the previous paragraph
|
---|
210 | //Shortcut.registerSystemCut("microsoft-reserved-17", tr("reserved"), VK_RIGHT, CTRL_DOWN_MASK | SHIFT_DOWN_MASK); // Select a block of text
|
---|
211 | //Shortcut.registerSystemCut("microsoft-reserved-18", tr("reserved"), VK_LEFT, CTRL_DOWN_MASK | SHIFT_DOWN_MASK); // Select a block of text
|
---|
212 | //Shortcut.registerSystemCut("microsoft-reserved-19", tr("reserved"), VK_DOWN, CTRL_DOWN_MASK | SHIFT_DOWN_MASK); // Select a block of text
|
---|
213 | //Shortcut.registerSystemCut("microsoft-reserved-20", tr("reserved"), VK_UP, CTRL_DOWN_MASK | SHIFT_DOWN_MASK); // Select a block of text
|
---|
214 | //Shortcut.registerSystemCut("microsoft-reserved-21", tr("reserved"), VK_RIGHT, SHIFT_DOWN_MASK); // Select more than one item in a window or on the desktop, or select text within a document
|
---|
215 | //Shortcut.registerSystemCut("microsoft-reserved-22", tr("reserved"), VK_LEFT, SHIFT_DOWN_MASK); // Select more than one item in a window or on the desktop, or select text within a document
|
---|
216 | //Shortcut.registerSystemCut("microsoft-reserved-23", tr("reserved"), VK_DOWN, SHIFT_DOWN_MASK); // Select more than one item in a window or on the desktop, or select text within a document
|
---|
217 | //Shortcut.registerSystemCut("microsoft-reserved-24", tr("reserved"), VK_UP, SHIFT_DOWN_MASK); // Select more than one item in a window or on the desktop, or select text within a document
|
---|
218 | //Shortcut.registerSystemCut("microsoft-reserved-25", tr("reserved"), VK_RIGHT+, CTRL_DOWN_MASK); // Select multiple individual items in a window or on the desktop (TODO: ctrl+arrow+spacebar, how to handle it in Java ?)
|
---|
219 | //Shortcut.registerSystemCut("microsoft-reserved-26", tr("reserved"), VK_LEFT+, CTRL_DOWN_MASK); // Select multiple individual items in a window or on the desktop (TODO: ctrl+arrow+spacebar, how to handle it in Java ?)
|
---|
220 | //Shortcut.registerSystemCut("microsoft-reserved-27", tr("reserved"), VK_DOWN+, CTRL_DOWN_MASK); // Select multiple individual items in a window or on the desktop (TODO: ctrl+arrow+spacebar, how to handle it in Java ?)
|
---|
221 | //Shortcut.registerSystemCut("microsoft-reserved-28", tr("reserved"), VK_UP+, CTRL_DOWN_MASK); // Select multiple individual items in a window or on the desktop (TODO: ctrl+arrow+spacebar, how to handle it in Java ?)
|
---|
222 | Shortcut.registerSystemShortcut("system:selectall", tr("reserved"), VK_A, CTRL_DOWN_MASK); // Select all items in a document or window
|
---|
223 | //Shortcut.registerSystemCut("system:search", tr("reserved"), VK_F3, 0); // Search for a file or folder
|
---|
224 | Shortcut.registerSystemShortcut("microsoft-reserved-31", tr("reserved"), VK_ENTER, ALT_DOWN_MASK).setAutomatic(); // Display properties for the selected item
|
---|
225 | Shortcut.registerSystemShortcut("system:exit", tr("reserved"), VK_F4, ALT_DOWN_MASK).setAutomatic(); // Close the active item, or exit the active program
|
---|
226 | Shortcut.registerSystemShortcut("microsoft-reserved-33", tr("reserved"), VK_SPACE, ALT_DOWN_MASK).setAutomatic(); // Open the shortcut menu for the active window
|
---|
227 | //Shortcut.registerSystemCut("microsoft-reserved-34", tr("reserved"), VK_F4, CTRL_DOWN_MASK); // Close the active document (in programs that allow you to have multiple documents open simultaneously)
|
---|
228 | Shortcut.registerSystemShortcut("microsoft-reserved-35", tr("reserved"), VK_TAB, ALT_DOWN_MASK).setAutomatic(); // Switch between open items
|
---|
229 | Shortcut.registerSystemShortcut("microsoft-reserved-36", tr("reserved"), VK_TAB, CTRL_DOWN_MASK | ALT_DOWN_MASK).setAutomatic(); // Use the arrow keys to switch between open items
|
---|
230 | //Shortcut.registerSystemCut("microsoft-reserved-37", tr("reserved"), VK_TAB, ); // Cycle through programs on the taskbar by using Aero Flip 3-D (TODO: Windows-Tab, how to handle it in Java ?)
|
---|
231 | //Shortcut.registerSystemCut("microsoft-reserved-38", tr("reserved"), VK_TAB, CTRL_DOWN_MASK | ); // Use the arrow keys to cycle through programs on the taskbar by using Aero Flip 3-D (TODO: Ctrl-Windows-Tab, how to handle it in Java ?)
|
---|
232 | Shortcut.registerSystemShortcut("microsoft-reserved-39", tr("reserved"), VK_ESCAPE, ALT_DOWN_MASK).setAutomatic(); // Cycle through items in the order in which they were opened
|
---|
233 | //Shortcut.registerSystemCut("microsoft-reserved-40", tr("reserved"), VK_F6, 0); // Cycle through screen elements in a window or on the desktop
|
---|
234 | //Shortcut.registerSystemCut("microsoft-reserved-41", tr("reserved"), VK_F4, 0); // Display the address bar list in Windows Explorer
|
---|
235 | Shortcut.registerSystemShortcut("microsoft-reserved-42", tr("reserved"), VK_F10, SHIFT_DOWN_MASK); // Display the shortcut menu for the selected item
|
---|
236 | Shortcut.registerSystemShortcut("microsoft-reserved-43", tr("reserved"), VK_ESCAPE, CTRL_DOWN_MASK).setAutomatic(); // Open the Start menu
|
---|
237 | //Shortcut.registerSystemShortcut("microsoft-reserved-44", tr("reserved"), VK_F10, 0); // Activate the menu bar in the active program
|
---|
238 | //Shortcut.registerSystemCut("microsoft-reserved-45", tr("reserved"), VK_RIGHT, 0); // Open the next menu to the right, or open a submenu
|
---|
239 | //Shortcut.registerSystemCut("microsoft-reserved-46", tr("reserved"), VK_LEFT, 0); // Open the next menu to the left, or close a submenu
|
---|
240 | //Shortcut.registerSystemCut("microsoft-reserved-47", tr("reserved"), VK_F5, 0); // Refresh the active window
|
---|
241 | //Shortcut.registerSystemCut("microsoft-reserved-48", tr("reserved"), VK_UP, ALT_DOWN_MASK); // View the folder one level up in Windows Explorer
|
---|
242 | //Shortcut.registerSystemCut("microsoft-reserved-49", tr("reserved"), VK_ESCAPE, 0); // Cancel the current task
|
---|
243 | Shortcut.registerSystemShortcut("microsoft-reserved-50", tr("reserved"), VK_ESCAPE, CTRL_DOWN_MASK | SHIFT_DOWN_MASK).setAutomatic(); // Open Task Manager
|
---|
244 | Shortcut.registerSystemShortcut("microsoft-reserved-51", tr("reserved"), VK_SHIFT, ALT_DOWN_MASK).setAutomatic(); // Switch the input language when multiple input languages are enabled
|
---|
245 | Shortcut.registerSystemShortcut("microsoft-reserved-52", tr("reserved"), VK_SHIFT, CTRL_DOWN_MASK).setAutomatic(); // Switch the keyboard layout when multiple keyboard layouts are enabled
|
---|
246 | //Shortcut.registerSystemCut("microsoft-reserved-53", tr("reserved"), ); // Change the reading direction of text in right-to-left reading languages (TODO: unclear)
|
---|
247 | // CHECKSTYLE.ON: LineLength
|
---|
248 | }
|
---|
249 |
|
---|
250 | @Override
|
---|
251 | public String getDefaultStyle() {
|
---|
252 | return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
---|
253 | }
|
---|
254 |
|
---|
255 | @Override
|
---|
256 | public boolean rename(File from, File to) {
|
---|
257 | if (to.exists())
|
---|
258 | Utils.deleteFile(to);
|
---|
259 | return from.renameTo(to);
|
---|
260 | }
|
---|
261 |
|
---|
262 | @Override
|
---|
263 | public String getOSDescription() {
|
---|
264 | return Utils.strip(getSystemProperty("os.name")) + ' ' +
|
---|
265 | ((getSystemEnv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit";
|
---|
266 | }
|
---|
267 |
|
---|
268 | /**
|
---|
269 | * Returns the Windows product name from registry (example: "Windows 10 Pro")
|
---|
270 | * @return the Windows product name from registry
|
---|
271 | * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
|
---|
272 | * @throws InvocationTargetException if the underlying method throws an exception
|
---|
273 | * @since 12744
|
---|
274 | */
|
---|
275 | public static String getProductName() throws IllegalAccessException, InvocationTargetException {
|
---|
276 | return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "ProductName");
|
---|
277 | }
|
---|
278 |
|
---|
279 | /**
|
---|
280 | * Returns the Windows release identifier from registry (example: "1703")
|
---|
281 | * @return the Windows release identifier from registry
|
---|
282 | * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
|
---|
283 | * @throws InvocationTargetException if the underlying method throws an exception
|
---|
284 | * @since 12744
|
---|
285 | */
|
---|
286 | public static String getReleaseId() throws IllegalAccessException, InvocationTargetException {
|
---|
287 | return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "ReleaseId");
|
---|
288 | }
|
---|
289 |
|
---|
290 | /**
|
---|
291 | * Returns the Windows current build number from registry (example: "15063")
|
---|
292 | * @return the Windows current build number from registry
|
---|
293 | * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
|
---|
294 | * @throws InvocationTargetException if the underlying method throws an exception
|
---|
295 | * @since 12744
|
---|
296 | */
|
---|
297 | public static String getCurrentBuild() throws IllegalAccessException, InvocationTargetException {
|
---|
298 | return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "CurrentBuild");
|
---|
299 | }
|
---|
300 |
|
---|
301 | private static String buildOSBuildNumber() {
|
---|
302 | StringBuilder sb = new StringBuilder();
|
---|
303 | try {
|
---|
304 | sb.append(getProductName());
|
---|
305 | String releaseId = getReleaseId();
|
---|
306 | if (releaseId != null) {
|
---|
307 | sb.append(' ').append(releaseId);
|
---|
308 | }
|
---|
309 | sb.append(" (").append(getCurrentBuild()).append(')');
|
---|
310 | } catch (ReflectiveOperationException | JosmRuntimeException | NoClassDefFoundError e) {
|
---|
311 | Logging.log(Logging.LEVEL_ERROR, "Unable to get Windows build number", e);
|
---|
312 | Logging.debug(e);
|
---|
313 | }
|
---|
314 | return sb.toString();
|
---|
315 | }
|
---|
316 |
|
---|
317 | @Override
|
---|
318 | public String getOSBuildNumber() {
|
---|
319 | if (oSBuildNumber == null) {
|
---|
320 | oSBuildNumber = buildOSBuildNumber();
|
---|
321 | }
|
---|
322 | return oSBuildNumber;
|
---|
323 | }
|
---|
324 |
|
---|
325 | /**
|
---|
326 | * Loads Windows-ROOT keystore.
|
---|
327 | * @return Windows-ROOT keystore
|
---|
328 | * @throws NoSuchAlgorithmException if the algorithm used to check the integrity of the keystore cannot be found
|
---|
329 | * @throws CertificateException if any of the certificates in the keystore could not be loaded
|
---|
330 | * @throws IOException if there is an I/O or format problem with the keystore data, if a password is required but not given
|
---|
331 | * @throws KeyStoreException if no Provider supports a KeyStore implementation for the type "Windows-ROOT"
|
---|
332 | * @since 7343
|
---|
333 | */
|
---|
334 | public static KeyStore getRootKeystore() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
|
---|
335 | KeyStore ks = KeyStore.getInstance(WINDOWS_ROOT);
|
---|
336 | ks.load(null, null);
|
---|
337 | return ks;
|
---|
338 | }
|
---|
339 |
|
---|
340 | @Override
|
---|
341 | public X509Certificate getX509Certificate(NativeCertAmend certAmend)
|
---|
342 | throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
|
---|
343 | // Get Windows Trust Root Store
|
---|
344 | KeyStore ks = getRootKeystore();
|
---|
345 | // Search by alias (fast)
|
---|
346 | for (String winAlias : certAmend.getNativeAliases()) {
|
---|
347 | Certificate result = ks.getCertificate(winAlias);
|
---|
348 | if (result == null && !NetworkManager.isOffline(OnlineResource.CERTIFICATES)) {
|
---|
349 | // Make a web request to target site to force Windows to update if needed its trust root store from its certificate trust list
|
---|
350 | // A better, but a lot more complex method might be to get certificate list from Windows Registry with PowerShell
|
---|
351 | // using (Get-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\SystemCertificates\\AuthRoot\\AutoUpdate').EncodedCtl)
|
---|
352 | // then decode it using CertUtil -dump or calling CertCreateCTLContext API using JNI, and finally find and decode the certificate
|
---|
353 | Logging.trace(webRequest(certAmend.getWebSite()));
|
---|
354 | // Reload Windows Trust Root Store and search again by alias (fast)
|
---|
355 | ks = getRootKeystore();
|
---|
356 | result = ks.getCertificate(winAlias);
|
---|
357 | }
|
---|
358 | if (result instanceof X509Certificate) {
|
---|
359 | return (X509Certificate) result;
|
---|
360 | }
|
---|
361 | }
|
---|
362 | // If not found, search by SHA-256 (slower)
|
---|
363 | MessageDigest md = MessageDigest.getInstance("SHA-256");
|
---|
364 | for (Enumeration<String> aliases = ks.aliases(); aliases.hasMoreElements();) {
|
---|
365 | String alias = aliases.nextElement();
|
---|
366 | Certificate result = ks.getCertificate(alias);
|
---|
367 | if (result instanceof X509Certificate
|
---|
368 | && certAmend.getSha256().equalsIgnoreCase(Utils.toHexString(md.digest(result.getEncoded())))) {
|
---|
369 | Logging.warn("Certificate not found for alias ''{0}'' but found for alias ''{1}''", certAmend.getNativeAliases(), alias);
|
---|
370 | return (X509Certificate) result;
|
---|
371 | }
|
---|
372 | }
|
---|
373 | // Not found
|
---|
374 | return null;
|
---|
375 | }
|
---|
376 |
|
---|
377 | @Override
|
---|
378 | public File getDefaultCacheDirectory() {
|
---|
379 | String p = getSystemEnv("LOCALAPPDATA");
|
---|
380 | if (p == null || p.isEmpty()) {
|
---|
381 | // Fallback for Windows OS earlier than Windows Vista, where the variable is not defined
|
---|
382 | p = getSystemEnv("APPDATA");
|
---|
383 | }
|
---|
384 | return new File(new File(p, Preferences.getJOSMDirectoryBaseName()), "cache");
|
---|
385 | }
|
---|
386 |
|
---|
387 | @Override
|
---|
388 | public File getDefaultPrefDirectory() {
|
---|
389 | return new File(getSystemEnv("APPDATA"), Preferences.getJOSMDirectoryBaseName());
|
---|
390 | }
|
---|
391 |
|
---|
392 | @Override
|
---|
393 | public File getDefaultUserDataDirectory() {
|
---|
394 | // Use preferences directory by default
|
---|
395 | return Config.getDirs().getPreferencesDirectory(false);
|
---|
396 | }
|
---|
397 |
|
---|
398 | /**
|
---|
399 | * <p>Add more fallback fonts to the Java runtime, in order to get
|
---|
400 | * support for more scripts.</p>
|
---|
401 | *
|
---|
402 | * <p>The font configuration in Java doesn't include some Indic scripts,
|
---|
403 | * even though MS Windows ships with fonts that cover these unicode ranges.</p>
|
---|
404 | *
|
---|
405 | * <p>To fix this, the fontconfig.properties template is copied to the JOSM
|
---|
406 | * cache folder. Then, the additional entries are added to the font
|
---|
407 | * configuration. Finally the system property "sun.awt.fontconfig" is set
|
---|
408 | * to the customized fontconfig.properties file.</p>
|
---|
409 | *
|
---|
410 | * <p>This is a crude hack, but better than no font display at all for these languages.
|
---|
411 | * There is no guarantee, that the template file
|
---|
412 | * ($JAVA_HOME/lib/fontconfig.properties.src) matches the default
|
---|
413 | * configuration (which is in a binary format).
|
---|
414 | * Furthermore, the system property "sun.awt.fontconfig" is undocumented and
|
---|
415 | * may no longer work in future versions of Java.</p>
|
---|
416 | *
|
---|
417 | * <p>Related Java bug: <a href="https://bugs.openjdk.java.net/browse/JDK-8008572">JDK-8008572</a></p>
|
---|
418 | *
|
---|
419 | * @param templateFileName file name of the fontconfig.properties template file
|
---|
420 | */
|
---|
421 | protected void extendFontconfig(String templateFileName) {
|
---|
422 | String customFontconfigFile = Config.getPref().get("fontconfig.properties", null);
|
---|
423 | if (customFontconfigFile != null) {
|
---|
424 | Utils.updateSystemProperty("sun.awt.fontconfig", customFontconfigFile);
|
---|
425 | return;
|
---|
426 | }
|
---|
427 | if (!Config.getPref().getBoolean("font.extended-unicode", true))
|
---|
428 | return;
|
---|
429 |
|
---|
430 | String javaLibPath = getSystemProperty("java.home") + File.separator + "lib";
|
---|
431 | Path templateFile = FileSystems.getDefault().getPath(javaLibPath, templateFileName);
|
---|
432 | String templatePath = templateFile.toString();
|
---|
433 | if (templatePath.startsWith("null") || !Files.isReadable(templateFile)) {
|
---|
434 | Logging.warn("extended font config - unable to find font config template file {0}", templatePath);
|
---|
435 | return;
|
---|
436 | }
|
---|
437 | try (InputStream fis = Files.newInputStream(templateFile)) {
|
---|
438 | Properties props = new Properties();
|
---|
439 | props.load(fis);
|
---|
440 | byte[] content = Files.readAllBytes(templateFile);
|
---|
441 | File cachePath = Config.getDirs().getCacheDirectory(true);
|
---|
442 | Path fontconfigFile = cachePath.toPath().resolve("fontconfig.properties");
|
---|
443 | OutputStream os = Files.newOutputStream(fontconfigFile);
|
---|
444 | os.write(content);
|
---|
445 | try (Writer w = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8))) {
|
---|
446 | Collection<FontEntry> extrasPref = StructUtils.getListOfStructs(Config.getPref(),
|
---|
447 | "font.extended-unicode.extra-items", getAdditionalFonts(), FontEntry.class);
|
---|
448 | Collection<FontEntry> extras = new ArrayList<>();
|
---|
449 | w.append("\n\n# Added by JOSM to extend unicode coverage of Java font support:\n\n");
|
---|
450 | List<String> allCharSubsets = new ArrayList<>();
|
---|
451 | for (FontEntry entry: extrasPref) {
|
---|
452 | Collection<String> fontsAvail = getInstalledFonts();
|
---|
453 | if (fontsAvail != null && fontsAvail.contains(entry.file.toUpperCase(Locale.ENGLISH))) {
|
---|
454 | if (!allCharSubsets.contains(entry.charset)) {
|
---|
455 | allCharSubsets.add(entry.charset);
|
---|
456 | extras.add(entry);
|
---|
457 | } else {
|
---|
458 | Logging.trace("extended font config - already registered font for charset ''{0}'' - skipping ''{1}''",
|
---|
459 | entry.charset, entry.name);
|
---|
460 | }
|
---|
461 | } else {
|
---|
462 | Logging.trace("extended font config - Font ''{0}'' not found on system - skipping", entry.name);
|
---|
463 | }
|
---|
464 | }
|
---|
465 | for (FontEntry entry: extras) {
|
---|
466 | allCharSubsets.add(entry.charset);
|
---|
467 | if ("".equals(entry.name)) {
|
---|
468 | continue;
|
---|
469 | }
|
---|
470 | String key = "allfonts." + entry.charset;
|
---|
471 | String value = entry.name;
|
---|
472 | String prevValue = props.getProperty(key);
|
---|
473 | if (prevValue != null && !prevValue.equals(value)) {
|
---|
474 | Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
|
---|
475 | }
|
---|
476 | w.append(key + '=' + value + '\n');
|
---|
477 | }
|
---|
478 | w.append('\n');
|
---|
479 | for (FontEntry entry: extras) {
|
---|
480 | if ("".equals(entry.name) || "".equals(entry.file)) {
|
---|
481 | continue;
|
---|
482 | }
|
---|
483 | String key = "filename." + entry.name.replace(' ', '_');
|
---|
484 | String value = entry.file;
|
---|
485 | String prevValue = props.getProperty(key);
|
---|
486 | if (prevValue != null && !prevValue.equals(value)) {
|
---|
487 | Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
|
---|
488 | }
|
---|
489 | w.append(key + '=' + value + '\n');
|
---|
490 | }
|
---|
491 | w.append('\n');
|
---|
492 | String fallback = props.getProperty("sequence.fallback");
|
---|
493 | if (fallback != null) {
|
---|
494 | w.append("sequence.fallback=" + fallback + ',' + Utils.join(",", allCharSubsets) + '\n');
|
---|
495 | } else {
|
---|
496 | w.append("sequence.fallback=" + Utils.join(",", allCharSubsets) + '\n');
|
---|
497 | }
|
---|
498 | }
|
---|
499 | Utils.updateSystemProperty("sun.awt.fontconfig", fontconfigFile.toString());
|
---|
500 | } catch (IOException | InvalidPathException ex) {
|
---|
501 | Logging.error(ex);
|
---|
502 | }
|
---|
503 | }
|
---|
504 |
|
---|
505 | /**
|
---|
506 | * Get a list of fonts that are installed on the system.
|
---|
507 | *
|
---|
508 | * Must be done without triggering the Java Font initialization.
|
---|
509 | * (See {@link #extendFontconfig(java.lang.String)}, have to set system
|
---|
510 | * property first, which is then read by sun.awt.FontConfiguration upon initialization.)
|
---|
511 | *
|
---|
512 | * @return list of file names
|
---|
513 | */
|
---|
514 | protected Collection<String> getInstalledFonts() {
|
---|
515 | // Cannot use GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()
|
---|
516 | // because we have to set the system property before Java initializes its fonts.
|
---|
517 | // Use more low-level method to find the installed fonts.
|
---|
518 | List<String> fontsAvail = new ArrayList<>();
|
---|
519 | Path fontPath = FileSystems.getDefault().getPath(getSystemEnv("SYSTEMROOT"), "Fonts");
|
---|
520 | try (DirectoryStream<Path> ds = Files.newDirectoryStream(fontPath)) {
|
---|
521 | for (Path p : ds) {
|
---|
522 | Path filename = p.getFileName();
|
---|
523 | if (filename != null) {
|
---|
524 | fontsAvail.add(filename.toString().toUpperCase(Locale.ENGLISH));
|
---|
525 | }
|
---|
526 | }
|
---|
527 | fontsAvail.add(""); // for devanagari
|
---|
528 | } catch (IOException | DirectoryIteratorException ex) {
|
---|
529 | Logging.log(Logging.LEVEL_ERROR, ex);
|
---|
530 | Logging.warn("extended font config - failed to load available Fonts");
|
---|
531 | fontsAvail = null;
|
---|
532 | }
|
---|
533 | return fontsAvail;
|
---|
534 | }
|
---|
535 |
|
---|
536 | /**
|
---|
537 | * Get default list of additional fonts to add to the configuration.
|
---|
538 | *
|
---|
539 | * Java will choose thee first font in the list that can render a certain character.
|
---|
540 | *
|
---|
541 | * @return list of FontEntry objects
|
---|
542 | */
|
---|
543 | protected Collection<FontEntry> getAdditionalFonts() {
|
---|
544 | Collection<FontEntry> def = new ArrayList<>(33);
|
---|
545 | def.add(new FontEntry("devanagari", "", "")); // just include in fallback list font already defined in template
|
---|
546 |
|
---|
547 | // Windows scripts: https://msdn.microsoft.com/en-us/goglobal/bb688099.aspx
|
---|
548 | // IE default fonts: https://msdn.microsoft.com/en-us/library/ie/dn467844(v=vs.85).aspx
|
---|
549 |
|
---|
550 | // Windows 10 and later
|
---|
551 | def.add(new FontEntry("historic", "Segoe UI Historic", "SEGUIHIS.TTF")); // historic charsets
|
---|
552 |
|
---|
553 | // Windows 8/8.1 and later
|
---|
554 | def.add(new FontEntry("javanese", "Javanese Text", "JAVATEXT.TTF")); // ISO 639: jv
|
---|
555 | def.add(new FontEntry("leelawadee", "Leelawadee", "LEELAWAD.TTF")); // ISO 639: bug
|
---|
556 | def.add(new FontEntry("malgun", "Malgun Gothic", "MALGUN.TTF")); // ISO 639: ko
|
---|
557 | def.add(new FontEntry("myanmar", "Myanmar Text", "MMRTEXT.TTF")); // ISO 639: my
|
---|
558 | def.add(new FontEntry("nirmala", "Nirmala UI", "NIRMALA.TTF")); // ISO 639: sat,srb
|
---|
559 | def.add(new FontEntry("segoeui", "Segoe UI", "SEGOEUI.TTF")); // ISO 639: lis
|
---|
560 | def.add(new FontEntry("emoji", "Segoe UI Emoji", "SEGUIEMJ.TTF")); // emoji symbol characters
|
---|
561 |
|
---|
562 | // Windows 7 and later
|
---|
563 | def.add(new FontEntry("nko_tifinagh_vai_osmanya", "Ebrima", "EBRIMA.TTF")); // ISO 639: ber. Nko only since Win 8
|
---|
564 | def.add(new FontEntry("khmer1", "Khmer UI", "KHMERUI.TTF")); // ISO 639: km
|
---|
565 | def.add(new FontEntry("lao1", "Lao UI", "LAOUI.TTF")); // ISO 639: lo
|
---|
566 | def.add(new FontEntry("tai_le", "Microsoft Tai Le", "TAILE.TTF")); // ISO 639: khb
|
---|
567 | def.add(new FontEntry("new_tai_lue", "Microsoft New Tai Lue", "NTHAILU.TTF")); // ISO 639: khb
|
---|
568 |
|
---|
569 | // Windows Vista and later:
|
---|
570 | def.add(new FontEntry("ethiopic", "Nyala", "NYALA.TTF")); // ISO 639: am,gez,ti
|
---|
571 | def.add(new FontEntry("tibetan", "Microsoft Himalaya", "HIMALAYA.TTF")); // ISO 639: bo,dz
|
---|
572 | def.add(new FontEntry("cherokee", "Plantagenet Cherokee", "PLANTC.TTF")); // ISO 639: chr
|
---|
573 | def.add(new FontEntry("unified_canadian", "Euphemia", "EUPHEMIA.TTF")); // ISO 639: cr,in
|
---|
574 | def.add(new FontEntry("khmer2", "DaunPenh", "DAUNPENH.TTF")); // ISO 639: km
|
---|
575 | def.add(new FontEntry("khmer3", "MoolBoran", "MOOLBOR.TTF")); // ISO 639: km
|
---|
576 | def.add(new FontEntry("lao_thai", "DokChampa", "DOKCHAMP.TTF")); // ISO 639: lo
|
---|
577 | def.add(new FontEntry("mongolian", "Mongolian Baiti", "MONBAITI.TTF")); // ISO 639: mn
|
---|
578 | def.add(new FontEntry("oriya", "Kalinga", "KALINGA.TTF")); // ISO 639: or
|
---|
579 | def.add(new FontEntry("sinhala", "Iskoola Pota", "ISKPOTA.TTF")); // ISO 639: si
|
---|
580 | def.add(new FontEntry("yi", "Yi Baiti", "MSYI.TTF")); // ISO 639: ii
|
---|
581 |
|
---|
582 | // Windows XP and later
|
---|
583 | def.add(new FontEntry("gujarati", "Shruti", "SHRUTI.TTF"));
|
---|
584 | def.add(new FontEntry("kannada", "Tunga", "TUNGA.TTF"));
|
---|
585 | def.add(new FontEntry("gurmukhi", "Raavi", "RAAVI.TTF"));
|
---|
586 | def.add(new FontEntry("telugu", "Gautami", "GAUTAMI.TTF"));
|
---|
587 | def.add(new FontEntry("bengali", "Vrinda", "VRINDA.TTF")); // since XP SP2
|
---|
588 | def.add(new FontEntry("syriac", "Estrangelo Edessa", "ESTRE.TTF")); // ISO 639: arc
|
---|
589 | def.add(new FontEntry("thaana", "MV Boli", "MVBOLI.TTF")); // ISO 639: dv
|
---|
590 | def.add(new FontEntry("malayalam", "Kartika", "KARTIKA.TTF")); // ISO 639: ml; since XP SP2
|
---|
591 |
|
---|
592 | // Windows 2000 and later
|
---|
593 | def.add(new FontEntry("tamil", "Latha", "LATHA.TTF"));
|
---|
594 |
|
---|
595 | // Comes with MS Office & Outlook 2000. Good unicode coverage, so add if available.
|
---|
596 | def.add(new FontEntry("arialuni", "Arial Unicode MS", "ARIALUNI.TTF"));
|
---|
597 |
|
---|
598 | return def;
|
---|
599 | }
|
---|
600 |
|
---|
601 | /**
|
---|
602 | * Determines if the .NET framework 4.5 (or later) is installed.
|
---|
603 | * Windows 7 ships by default with an older version.
|
---|
604 | * @return {@code true} if the .NET framework 4.5 (or later) is installed.
|
---|
605 | * @since 13463
|
---|
606 | */
|
---|
607 | public static boolean isDotNet45Installed() {
|
---|
608 | try {
|
---|
609 | // https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#net_d
|
---|
610 | // "The existence of the Release DWORD indicates that the .NET Framework 4.5 or later has been installed"
|
---|
611 | // Great, but our WinRegistry only handles REG_SZ type, so we have to check the Version key
|
---|
612 | String version = WinRegistry.readString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full", "Version");
|
---|
613 | if (version != null) {
|
---|
614 | Matcher m = MS_VERSION_PATTERN.matcher(version);
|
---|
615 | if (m.matches()) {
|
---|
616 | int maj = Integer.parseInt(m.group(1));
|
---|
617 | int min = Integer.parseInt(m.group(2));
|
---|
618 | return (maj == 4 && min >= 5) || maj > 4;
|
---|
619 | }
|
---|
620 | }
|
---|
621 | } catch (IllegalAccessException | InvocationTargetException | NumberFormatException e) {
|
---|
622 | Logging.error(e);
|
---|
623 | }
|
---|
624 | return false;
|
---|
625 | }
|
---|
626 |
|
---|
627 | /**
|
---|
628 | * Returns the major version number of PowerShell.
|
---|
629 | * @return the major version number of PowerShell. -1 in case of error
|
---|
630 | * @since 13465
|
---|
631 | */
|
---|
632 | public static int getPowerShellVersion() {
|
---|
633 | try {
|
---|
634 | String version = WinRegistry.readString(
|
---|
635 | HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Powershell\\3\\PowershellEngine", "PowershellVersion");
|
---|
636 | if (version != null) {
|
---|
637 | Matcher m = MS_VERSION_PATTERN.matcher(version);
|
---|
638 | if (m.matches()) {
|
---|
639 | return Integer.parseInt(m.group(1));
|
---|
640 | }
|
---|
641 | }
|
---|
642 | } catch (NumberFormatException | IllegalAccessException | InvocationTargetException e) {
|
---|
643 | Logging.error(e);
|
---|
644 | }
|
---|
645 | return -1;
|
---|
646 | }
|
---|
647 |
|
---|
648 | /**
|
---|
649 | * Performs a web request using Windows CryptoAPI (through PowerShell).
|
---|
650 | * This is useful to ensure Windows trust store will contain a specific root CA.
|
---|
651 | * @param uri the web URI to request
|
---|
652 | * @return HTTP response from the given URI
|
---|
653 | * @throws IOException if any I/O error occurs
|
---|
654 | * @since 13458
|
---|
655 | */
|
---|
656 | public static String webRequest(String uri) throws IOException {
|
---|
657 | // With PS 6.0 (not yet released in Windows) we could simply use:
|
---|
658 | // Invoke-WebRequest -SSlProtocol Tsl12 $uri
|
---|
659 | // .NET framework < 4.5 does not support TLS 1.2 (https://stackoverflow.com/a/43240673/2257172)
|
---|
660 | if (isDotNet45Installed() && getPowerShellVersion() >= 3) {
|
---|
661 | try {
|
---|
662 | // The following works with PS 3.0 (Windows 8+), https://stackoverflow.com/a/41618979/2257172
|
---|
663 | return Utils.execOutput(Arrays.asList("powershell", "-Command",
|
---|
664 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;"+
|
---|
665 | "[System.Net.WebRequest]::Create('"+uri+"').GetResponse()"
|
---|
666 | ), 5, TimeUnit.SECONDS);
|
---|
667 | } catch (ExecutionException | InterruptedException e) {
|
---|
668 | Logging.warn("Unable to request certificate of " + uri);
|
---|
669 | Logging.debug(e);
|
---|
670 | }
|
---|
671 | }
|
---|
672 | return null;
|
---|
673 | }
|
---|
674 |
|
---|
675 | @Override
|
---|
676 | public File resolveFileLink(File file) {
|
---|
677 | if (file.getName().endsWith(".lnk")) {
|
---|
678 | try {
|
---|
679 | return new File(new WindowsShortcut(file).getRealFilename());
|
---|
680 | } catch (IOException | ParseException e) {
|
---|
681 | Logging.error(e);
|
---|
682 | }
|
---|
683 | }
|
---|
684 | return file;
|
---|
685 | }
|
---|
686 |
|
---|
687 | @Override
|
---|
688 | public Collection<String> getPossiblePreferenceDirs() {
|
---|
689 | Set<String> locations = new HashSet<>();
|
---|
690 | String appdata = getSystemEnv("APPDATA");
|
---|
691 | if (appdata != null && getSystemEnv("ALLUSERSPROFILE") != null
|
---|
692 | && appdata.lastIndexOf(File.separator) != -1) {
|
---|
693 | appdata = appdata.substring(appdata.lastIndexOf(File.separator));
|
---|
694 | locations.add(new File(new File(getSystemEnv("ALLUSERSPROFILE"), appdata), "JOSM").getPath());
|
---|
695 | }
|
---|
696 | return locations;
|
---|
697 | }
|
---|
698 | }
|
---|