Changeset 13647 in josm for trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
- Timestamp:
- 2018-04-19T20:37:16+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r13487 r13647 27 27 import static java.awt.event.KeyEvent.VK_Z; 28 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; 29 31 import static org.openstreetmap.josm.tools.WinRegistry.HKEY_LOCAL_MACHINE; 30 32 … … 270 272 @Override 271 273 public String getOSDescription() { 272 return Utils.strip( System.getProperty("os.name")) + ' ' +273 (( System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit";274 return Utils.strip(getSystemProperty("os.name")) + ' ' + 275 ((getSystemEnv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit"; 274 276 } 275 277 … … 316 318 } 317 319 sb.append(" (").append(getCurrentBuild()).append(')'); 318 } catch (ReflectiveOperationException | JosmRuntimeException e) { 319 Logging.error(e); 320 } catch (ReflectiveOperationException | JosmRuntimeException | NoClassDefFoundError e) { 321 Logging.log(Logging.LEVEL_ERROR, "Unable to get Windows build number", e); 322 Logging.debug(e); 320 323 } 321 324 return sb.toString(); … … 473 476 @Override 474 477 public File getDefaultCacheDirectory() { 475 String p = System.getenv("LOCALAPPDATA");478 String p = getSystemEnv("LOCALAPPDATA"); 476 479 if (p == null || p.isEmpty()) { 477 480 // Fallback for Windows OS earlier than Windows Vista, where the variable is not defined 478 p = System.getenv("APPDATA");481 p = getSystemEnv("APPDATA"); 479 482 } 480 483 return new File(new File(p, Main.pref.getJOSMDirectoryBaseName()), "cache"); … … 483 486 @Override 484 487 public File getDefaultPrefDirectory() { 485 return new File( System.getenv("APPDATA"), Main.pref.getJOSMDirectoryBaseName());488 return new File(getSystemEnv("APPDATA"), Main.pref.getJOSMDirectoryBaseName()); 486 489 } 487 490 … … 524 527 return; 525 528 526 String javaLibPath = System.getProperty("java.home") + File.separator + "lib";529 String javaLibPath = getSystemProperty("java.home") + File.separator + "lib"; 527 530 Path templateFile = FileSystems.getDefault().getPath(javaLibPath, templateFileName); 528 if (!Files.isReadable(templateFile)) { 529 Logging.warn("extended font config - unable to find font config template file {0}", templateFile.toString()); 531 String templatePath = templateFile.toString(); 532 if (templatePath.startsWith("null") || !Files.isReadable(templateFile)) { 533 Logging.warn("extended font config - unable to find font config template file {0}", templatePath); 530 534 return; 531 535 } … … 612 616 // Use more low-level method to find the installed fonts. 613 617 List<String> fontsAvail = new ArrayList<>(); 614 Path fontPath = FileSystems.getDefault().getPath( System.getenv("SYSTEMROOT"), "Fonts");618 Path fontPath = FileSystems.getDefault().getPath(getSystemEnv("SYSTEMROOT"), "Fonts"); 615 619 try (DirectoryStream<Path> ds = Files.newDirectoryStream(fontPath)) { 616 620 for (Path p : ds) {
Note:
See TracChangeset
for help on using the changeset viewer.