Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,13 @@ class BuildTool
var ver = extract_version.matched(1);
var split_best = best.split(".");
var split_ver = ver.split(".");
if (Std.parseFloat(split_ver[0]) > Std.parseFloat(split_best[0]) || Std.parseFloat(split_ver[1]) > Std.parseFloat(split_best[1]))
var major_ver = Std.parseFloat(split_ver[0]);
var minor_ver = Std.parseFloat(split_ver[1]);
var major_best = Std.parseFloat(split_best[0]);
var minor_best = Std.parseFloat(split_best[1]);
if (major_ver == major_best && Math.isNaN(minor_best))
best = ver;
else if (major_ver > major_best || minor_ver > minor_best)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't these two branches here be combined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, yes, but it felt like too much complexity for a single if condition. Separating them made them feel easier to understand.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the logic be simpler if incomplete version numbers are just ignored altogether, since it will always lead to an invalid MACOSX_VER value?
.e.g

if (Math.isNan(major_ver) || Math.isNan(minor_ver))
   continue;

Also it seems the second condition would be more correct if it was major_ver > major_best || (major_ver == major_best && minor_ver > minor_best).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that makes sense to me. I think maybe I was trying to support MacOSX26.sdk as a valid fallback if there's some strange situation where MacOSX26.0.sdk didn't exist. However, maybe that wouldn't ever happen.

best = ver;
}
}
Expand Down
Loading