os-macosx.mm: Use uname() instead of Gestalt for version check. Allow 10.5 and over still. Fixes #585. Fixes #815. Thanks @erikcharlebois and @jckarter for the motivation and the fix.

db4
Doug Coleman 2013-03-26 16:51:53 -07:00
parent 3e209587c5
commit 08715bae04
1 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <mach/mach_time.h> #include <mach/mach_time.h>
#include <sys/utsname.h>
#include "master.hpp" #include "master.hpp"
namespace factor namespace factor
@ -11,17 +13,18 @@ void factor_vm::c_to_factor_toplevel(cell quot)
c_to_factor(quot); c_to_factor(quot);
} }
// Darwin 9 is 10.5, Darwin 10 is 10.6
// http://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
void early_init(void) void early_init(void)
{ {
SInt32 version; struct utsname u;
Gestalt(gestaltSystemVersion,&version); int n;
if(version < 0x1050) uname(&u);
{ sscanf(u.release,"%d", &n);
if(n < 9) {
std::cout << "Factor requires Mac OS X 10.5 or later.\n"; std::cout << "Factor requires Mac OS X 10.5 or later.\n";
exit(1); exit(1);
} }
[[NSAutoreleasePool alloc] init];
} }
const char *vm_executable_path(void) const char *vm_executable_path(void)