Skip to content

Commit 6bb231c

Browse files
committed
Fixes various version issues for Big Sur, Monterey, and beyond.
1 parent 6481665 commit 6bb231c

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"email": "am@jonesiscoding.com"
1010
}
1111
],
12-
"version": "1.9",
12+
"version": "1.10",
1313
"autoload": {
1414
"psr-4": {
1515
"DevCoding\\Mac\\": "src"

src/Command/AbstractMacConsole.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,25 @@ protected function isBigSurUp()
135135
{
136136
if ($v = $this->getOs()->getVersion())
137137
{
138-
// In some early testing, the version returned was 10.18 or something silly
139-
if (11 == $v->getMajor() || 10 == $v->getMajor() && $v->getMinor() >= 16)
138+
if ($v->getMajor() >= 11)
139+
{
140+
return true;
141+
}
142+
}
143+
144+
return false;
145+
}
146+
147+
/**
148+
* Determines if the OS version is Big Sur or greater.
149+
*
150+
* @return bool
151+
*/
152+
protected function isMontereyUp()
153+
{
154+
if ($v = $this->getOs()->getVersion())
155+
{
156+
if ($v->getMajor() >= 12)
140157
{
141158
return true;
142159
}
@@ -154,7 +171,7 @@ protected function isCatalinaUp()
154171
{
155172
if ($v = $this->getOs()->getVersion())
156173
{
157-
if (11 == $v->getMajor() || 10 == $v->getMajor() && $v->getMinor() >= 15)
174+
if ($v->getMajor() >= 11 || (10 == $v->getMajor() && $v->getMinor() >= 15))
158175
{
159176
return true;
160177
}
@@ -172,7 +189,7 @@ protected function isMojaveUp()
172189
{
173190
if ($v = $this->getOs()->getVersion())
174191
{
175-
if (11 == $v->getMajor() || 10 == $v->getMajor() && $v->getMinor() >= 14)
192+
if ($v->getMajor() >= 11 || (10 == $v->getMajor() && $v->getMinor() >= 14))
176193
{
177194
return true;
178195
}
@@ -260,7 +277,9 @@ protected function getLaunchUserId()
260277

261278
protected function getLaunchMethod()
262279
{
263-
return $this->getOs()->getVersion()->getMinor() <= 9 ? 'bsexec' : 'asuser';
280+
$version = $this->getOs()->getVersion();
281+
282+
return ($version->getMajor() > 10 || $version->getMinor() > 9) ? 'asuser' : 'bsexec';
264283
}
265284

266285
/**

0 commit comments

Comments
 (0)