Skip to content

Commit 13790c1

Browse files
authored
fix: macOS SDK detection regex (#703)
1 parent 5b0018d commit 13790c1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils/sdk.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ function maybeRemoveOldXcodes() {
8989
// Extract the SDK version from the toolchain file and normalize it.
9090
function extractSDKVersion(toolchainFile) {
9191
const contents = fs.readFileSync(toolchainFile, 'utf8');
92-
const match = /macOS\s(\d+(\.\d+)?)\sSDK\n\#/.exec(contents);
93-
if (!match) return null;
92+
const match = /macOS\s+(?:(\d+(?:\.\d+)?)\s+SDK|SDK\s+(\d+(?:\.\d+)?))/.exec(contents);
9493

95-
return match[1].includes('.') ? match[1] : `${match[1]}.0`;
94+
if (match?.[1]) return match[1].includes('.') ? match[1] : `${match[1]}.0`;
95+
if (match?.[2]) return match[2].includes('.') ? match[2] : `${match[2]}.0`;
96+
97+
return null;
9698
}
9799

98100
function expectedSDKVersion() {
@@ -110,6 +112,7 @@ function expectedSDKVersion() {
110112
}
111113

112114
const version = extractSDKVersion(macToolchainPy);
115+
console.log('version: ', version);
113116
if (isNaN(Number(version)) || !SDKs[version]) {
114117
console.warn(
115118
color.warn,

0 commit comments

Comments
 (0)