Changeset 19041 in josm


Ignore:
Timestamp:
2024-04-18T07:20:26+02:00 (8 months ago)
Author:
GerdP
Message:

see #23619: prefer to show key SOFTWARE\Microsoft\Windows\NT\CurrentVersion\DisplayVersion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r18985 r19041  
    293293
    294294    /**
     295     * Returns the Windows display version from registry (example: "22H2")
     296     * @return the Windows display version from registry
     297     * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
     298     * @throws InvocationTargetException if the underlying method throws an exception
     299     * @since 19041
     300     */
     301    public static String getDisplayVersion() throws IllegalAccessException, InvocationTargetException {
     302        return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "DisplayVersion");
     303    }
     304
     305    /**
    295306     * Returns the Windows current build number from registry (example: "15063")
    296307     * @return the Windows current build number from registry
     
    307318        try {
    308319            sb.append(getProductName());
    309             String releaseId = getReleaseId();
    310             if (releaseId != null) {
    311                 sb.append(' ').append(releaseId);
     320            String displayVersion = getDisplayVersion();
     321            if (displayVersion != null) {
     322                sb.append(' ').append(displayVersion);
     323            } else {
     324                String releaseId = getReleaseId();
     325                if (releaseId != null) {
     326                    sb.append(' ').append(releaseId);
     327                }
    312328            }
    313329            sb.append(" (").append(getCurrentBuild()).append(')');
Note: See TracChangeset for help on using the changeset viewer.