提交 05ed5fb9 编写于 作者: B bchristi

7178922: (props) re-visit how os.name is determined on Mac

Reviewed-by: alanb, mchung, skovatch, serb
上级 65d22d88
......@@ -145,27 +145,22 @@ PreferredToolkit getPreferredToolkit() {
return pref = HToolkit;
}
void setUnknownOSAndVersion(java_props_t *sprops) {
sprops->os_name = strdup("Unknown");
sprops->os_version = strdup("Unknown");
}
void setOSNameAndVersion(java_props_t *sprops) {
void *jrsFwk = getJRSFramework();
if (jrsFwk == NULL) {
setUnknownOSAndVersion(sprops);
return;
}
/* Don't rely on JRSCopyOSName because there's no guarantee the value will
* remain the same, or even if the JRS functions will continue to be part of
* Mac OS X. So hardcode os_name, and fill in os_version if we can.
*/
sprops->os_name = strdup("Mac OS X");
char *(*copyOSName)() = dlsym(jrsFwk, "JRSCopyOSName");
char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion");
if (copyOSName == NULL || copyOSVersion == NULL) {
setUnknownOSAndVersion(sprops);
return;
void *jrsFwk = getJRSFramework();
if (jrsFwk != NULL) {
char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion");
if (copyOSVersion != NULL) {
sprops->os_version = copyOSVersion();
return;
}
}
sprops->os_name = copyOSName();
sprops->os_version = copyOSVersion();
sprops->os_version = strdup("Unknown");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册