Skip to content

Commit

Permalink
Add build number to OS X OSInfo.
Browse files Browse the repository at this point in the history
This change also removes the architecture
from the OSInfo string, since it is noisy.

The old code would always emit "i386", seemingly
since that's the "lowest" fatch arch that the current
OS X x86_64 kernels will run binaries from.

I tried to update the code, but instead of x86_64, I
got "x86_64h", which is Apple's arch string for
Haswell chips.

I don't think it makes sense anymore to have the
architecture string in the OSInfo on OS X. All
Macs running the modern OSes are x86_64 anyway.

Fixes #1341
  • Loading branch information
mkrautz committed Apr 17, 2016
1 parent 48cc538 commit 72ef902
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/OSInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,19 @@ QString OSInfo::getOSVersion() {
if (err != noErr)
return QString::number(QSysInfo::MacintoshVersion, 16);

const NXArchInfo *local = NXGetLocalArchInfo();
const NXArchInfo *ai = local ? NXGetArchInfoFromCpuType(local->cputype, CPU_SUBTYPE_MULTIPLE) : NULL;
const char *arch = ai ? ai->name : "unknown";
char *buildno = NULL;
char buildno_buf[32];
size_t sz_buildno_buf = sizeof(buildno);
int ret = sysctlbyname("kern.osversion", buildno_buf, &sz_buildno_buf, NULL, 0);
if (ret == 0) {
buildno = &buildno_buf[0];
}

os.sprintf("%lu.%lu.%lu (%s)",
os.sprintf("%lu.%lu.%lu %s",
static_cast<unsigned long>(major),
static_cast<unsigned long>(minor),
static_cast<unsigned long>(bugfix),
arch);
buildno ? buildno : "unknown");
#else
#ifdef Q_OS_LINUX
QProcess qp;
Expand Down

0 comments on commit 72ef902

Please sign in to comment.