Skip to content

Commit

Permalink
Improve system attribute 1002 on macOS
Browse files Browse the repository at this point in the history
`Latin1Environment class>>#systemConverterClass` checks that attribute and now returns the correct converter class on macOS Big Sur.
  • Loading branch information
fniephaus committed Jul 8, 2021
1 parent 62c0e77 commit d13b272
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public final class SqueakSystemAttributes {
public SqueakSystemAttributes(final SqueakImageContext image) {
this.image = image;

final String osName = System.getProperty("os.name");
final String osVersion = System.getProperty("os.version");
final String osArch = System.getProperty("os.arch");
final String osName = System.getProperty("os.name", "unknown os.name");
final String osVersion = System.getProperty("os.version", "unknown os.version");
final String osArch = System.getProperty("os.arch", "unknown os.arch");

final String separator = File.separator;
vmPath = asByteString(System.getProperty("java.home") + separator + "bin" + separator + "java");
Expand All @@ -57,10 +57,23 @@ public SqueakSystemAttributes(final SqueakImageContext image) {

String value;
if (OS.isMacOS()) {
/* The image expects things like 1095, so convert 10.10.5 into 1010.5 */
value = System.getProperty("os.version", "unknown").replaceFirst("\\.", "");
/*
* The image expects things like 1095, so convert 10.10.5 into 1010.5 (e.g., see
* #systemConverterClass)
*/
value = "1016.0";
final String[] osVersionParts = osVersion.split("\\.");
if (osVersionParts.length == 2) {
final String major = osVersionParts[0];
try {
final int minor = Integer.parseInt(osVersionParts[1]);
value = String.format("%s%02d.0", major, minor);
} catch (final NumberFormatException e) {
// give up
}
}
} else {
value = System.getProperty("os.version", "unknown");
value = osVersion;
}
operatingSystemVersion = asByteString(value);

Expand Down

0 comments on commit d13b272

Please sign in to comment.