// our OS version is the same in non GUI and GUI cases wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn) { // This returns 10 and 6 for OS X 10.6, consistent with behaviour on // other platforms. SInt32 maj, min; Gestalt(gestaltSystemVersionMajor, &maj); Gestalt(gestaltSystemVersionMinor, &min); if ( majorVsn != NULL ) *majorVsn = maj; if ( minorVsn != NULL ) *minorVsn = min; return wxOS_MAC_OSX_DARWIN; }
/*** INITALISE MENUBAR ***/ OSStatus InitMenubar( void ) { // set menu bar Handle menuBar; #if TARGET_API_MAC_CARBON long result; if ((Gestalt(gestaltMenuMgrAttr, &result) == noErr) && (result & gestaltMenuMgrAquaLayoutMask)) menuBar = GetNewMBar( kMenuXBaseID); else #endif menuBar = GetNewMBar( kMenuBaseID ); SetMenuBar( menuBar ); // get menu references appleMenu = GetMenuRef( kAppleMenu ); fileMenu = GetMenuRef( kFileMenu ); editMenu = GetMenuRef( kEditMenu ); findMenu = GetMenuRef( kFindMenu ); optionsMenu = GetMenuRef( kOptionsMenu ); colorMenu = GetMenuRef( kColorMenu ); windowMenu = GetMenuRef( kWindowMenu ); #if !TARGET_API_MAC_CARBON AppendResMenu( appleMenu, 'DRVR' ); #endif AppendResMenu( colorMenu, 'HEct' ); // LR: add color scheme menu DrawMenuBar(); return noErr; }
WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* pInfo) { #ifdef LINUX #define CMD_RES_SIZE 2048 str_t pBuf[CMD_RES_SIZE]; SystemCall ("cat /proc/cpuinfo | grep \"processor\" | wc -l", pBuf, CMD_RES_SIZE); pInfo->ProcessorCount = atoi (pBuf); if (pInfo->ProcessorCount == 0) { pInfo->ProcessorCount = 1; } return WELS_THREAD_ERROR_OK; #undef CMD_RES_SIZE #else SInt32 cpunumber; Gestalt (gestaltCountOfCPUs, &cpunumber); pInfo->ProcessorCount = cpunumber; return WELS_THREAD_ERROR_OK; #endif//LINUX }
static pascal void ListBoxDrawProc( ControlRef browser , DataBrowserItemID item , DataBrowserPropertyID property , DataBrowserItemState itemState , const Rect *itemRect , SInt16 depth , Boolean isColorDevice ) { CFStringRef cfString; long systemVersion; cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item ); ThemeDrawingState themeState ; GetThemeDrawingState( &themeState ) ; if ( itemState == kDataBrowserItemIsSelected ) // In this sample we handle the "selected" state, all others fall through to our "active" state { Gestalt( gestaltSystemVersion, &systemVersion ); if ( (systemVersion >= 0x00001030) && (IsControlActive( browser ) == false) ) // Panther DB starts using kThemeBrushSecondaryHighlightColor for inactive browser hilighting SetThemePen( kThemeBrushSecondaryHighlightColor, 32, true ); else SetThemePen( kThemeBrushPrimaryHighlightColor, 32, true ); PaintRect( itemRect ); // First paint the hilite rect, then the text on top SetThemeDrawingState( themeState , false ) ; } DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL ); if ( cfString != NULL ) CFRelease( cfString ); SetThemeDrawingState( themeState , true ) ; }
static VALUE rb_GetQTVersion(VALUE self){ long version = 0L; if(Gestalt(gestaltQuickTime, &version) == noErr){ char version_str[8]; sprintf(version_str, "%x", ((version >> 16) & 0xFFFF)); return INT2FIX(atoi(version_str)); }else{
PlatformBinding::PlatformBinding(KObjectRef global) : StaticBoundObject("Platform"), global(global) { std::string os_name = Poco::Environment::osName(); #ifdef OS_OSX NSString *str; #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 SInt32 major, minor, bugfix; OSErr err1 = Gestalt(gestaltSystemVersionMajor, &major); OSErr err2 = Gestalt(gestaltSystemVersionMinor, &minor); OSErr err3 = Gestalt(gestaltSystemVersionBugFix, &bugfix); if (!err1 && !err2 && !err3) { str = [NSString stringWithFormat:@"%d.%d.%d", major, minor, bugfix]; }
wxVideoMode wxDisplay::GetCurrentMode() const { unsigned long dwDMVer; wxVideoMode RetMode; Gestalt(gestaltDisplayMgrVers, (long*) &dwDMVer); //Check DM version (for backward compatibility only - 7.5.3+ use 2.0) if (dwDMVer >= 0x020000) //version 2? { VDSwitchInfoRec sMode; //Note - csMode member also contains the bit depth if (DMGetDisplayMode(m_priv->m_hndl, &sMode) == noErr) { DMListIndexType nNumModes; DMListType pModes; DMDisplayModeListIteratorUPP uppMLI; DisplayIDType nDisplayID; wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr); //Create a new list... wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr, wxT("Could not create a new display mode list") ); uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc); wxASSERT(uppMLI); DMModeTransRec sModeInfo; sModeInfo.bMatched = false; sModeInfo.psMode = &sMode; for (DMListIndexType i = 0; i < nNumModes; ++i) { wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo) == noErr); if ( sModeInfo.bMatched == true ) { RetMode = sModeInfo.Mode; break; } } DisposeDMDisplayModeListIteratorUPP(uppMLI); wxASSERT(DMDisposeList(pModes) == noErr); } else //Can't get current mode? { wxLogSysError(wxString::Format(wxT("Couldn't obtain current display mode!!!\ndwDMVer:%u"), (unsigned int) dwDMVer)); } } else //DM ver 1 { wxLogSysError(wxString::Format(wxT("Display Manager Version %u Not Supported! Present? %s"), (unsigned int) dwDMVer / 0x10000, (dwDMVer & (1 << gestaltDisplayMgrPresent) ? wxT("Yes") : wxT("No")) ) ); } return RetMode; }
OSErr RVRequestVideoSetting (VideoRequestRecPtr requestRecPtr) { Boolean displayMgrPresent; short iCount = 0; // just a counter of GDevices we have seen DMDisplayModeListIteratorUPP myModeIteratorProc = nil; // for DM2.0 searches SpBlock spBlock; Boolean suppliedGDevice; DisplayIDType theDisplayID; // for DM2.0 searches DMListIndexType theDisplayModeCount; // for DM2.0 searches DMListType theDisplayModeList; // for DM2.0 searches long value = 0; GDHandle walkDevice = nil; // for everybody Gestalt(gestaltDisplayMgrAttr,&value); displayMgrPresent=value&(1<<gestaltDisplayMgrPresent); displayMgrPresent=displayMgrPresent && (SVersion(&spBlock)==noErr); // need slot manager if (displayMgrPresent) { // init the needed data before we start if (requestRecPtr->screenDevice) // user wants a specifc device? { walkDevice = requestRecPtr->screenDevice; suppliedGDevice = true; } else { walkDevice = DMGetFirstScreenDevice (dmOnlyActiveDisplays); // for everybody suppliedGDevice = false; } myModeIteratorProc = NewDMDisplayModeListIteratorProc(ModeListIterator); // for DM2.0 searches // Note that we are hosed if somebody changes the gdevice list behind our backs while we are iterating.... // ...now do the loop if we can start if( walkDevice && myModeIteratorProc) do // start the search { iCount++; // GDevice we are looking at (just a counter) if( noErr == DMGetDisplayIDByGDevice( walkDevice, &theDisplayID, false ) ) // DM1.0 does not need this, but it fits in the loop { theDisplayModeCount = 0; // for DM2.0 searches if (noErr == DMNewDisplayModeList(theDisplayID, 0, 0, &theDisplayModeCount, &theDisplayModeList) ) { // search NuBus & PCI the new kool way through Display Manager 2.0 GetRequestTheDM2Way (requestRecPtr, walkDevice, myModeIteratorProc, theDisplayModeCount, &theDisplayModeList); DMDisposeList(theDisplayModeList); // now toss the lists for this gdevice and go on to the next one } else { // search NuBus only the old disgusting way through the slot manager GetRequestTheDM1Way (requestRecPtr, walkDevice); } } } while ( !suppliedGDevice && nil != (walkDevice = DMGetNextScreenDevice ( walkDevice, dmOnlyActiveDisplays )) ); // go until no more gdevices if( myModeIteratorProc ) DisposeRoutineDescriptor(myModeIteratorProc); return (noErr); // we were able to get the look for a match } return (-1); // return a generic error }
QRUNINFO_NAMEPASE_BEGIN quint64 RunInfo::installedMemory() { SInt32 mb = 0; Gestalt(gestaltPhysicalRAMSizeInMegabytes, &mb); return quint64(static_cast<quint64>(mb) * 1024LL * 1024LL); }
//----------------------------------------------- static Boolean SystemVersionRequired(int version) { SInt32 result; Gestalt( gestaltSystemVersion, &result ); gOnPanther = (result >= 0x1030); gOnTiger = (result >= 0x1040); return (result >= version); }
Boolean IsQuickTimeInstalled(void) { OSErr err; long lResult; err = Gestalt(gestaltQuickTime, &lResult); return (err == noErr); }
pascal OSErr PBCatSearchSyncCompat(CSParamPtr paramBlock) { static Boolean fullExtFSDispatchingtested = false; static Boolean hasFullExtFSDispatching = false; OSErr result; Boolean supportsCatSearch; long response; GetVolParmsInfoBuffer volParmsInfo; long infoSize; result = noErr; /* See if File Manager will pass CatSearch requests to external file systems */ /* we will store the results in a static variable so we do NOT have to call Gestalt */ /* everytime we are called. */ if ( !fullExtFSDispatchingtested ) { fullExtFSDispatchingtested = true; if ( Gestalt(gestaltFSAttr, &response) == noErr ) { hasFullExtFSDispatching = ((response & (1L << gestaltFullExtFSDispatching)) != 0); } } /* CatSearch is a per volume attribute, so we have to check each time we are */ /* called to see if it is available on the volume specified. */ supportsCatSearch = false; if ( hasFullExtFSDispatching ) { infoSize = sizeof(GetVolParmsInfoBuffer); result = HGetVolParms(paramBlock->ioNamePtr, paramBlock->ioVRefNum, &volParmsInfo, &infoSize); if ( result == noErr ) { supportsCatSearch = hasCatSearch(volParmsInfo); } } /* noErr or paramErr is OK here. */ /* paramErr just means that GetVolParms is NOT supported by this volume */ if ( (result == noErr) || (result == paramErr) ) { if ( supportsCatSearch ) { /* Volume supports CatSearch so use it. */ /* CatSearch is faster than an indexed search. */ result = PBCatSearchSync(paramBlock); } else { /* Volume does NOT support CatSearch so */ /* search using IndexedSearch from root directory. */ result = IndexedSearch(paramBlock, fsRtDirID); } } return ( result ); }
Word BURGERCALL GetQuickTimeVersion(void) { long gestaltAnswer; if (!Gestalt(gestaltQuickTimeVersion,&gestaltAnswer)) { return (gestaltAnswer >> 16)&0xFFFF; /* Major version */ } return 0; /* No quicktime */ }
int macosx_version() { SInt32 gestalt_version; static int ver = 0; // cached if (0 == ver && (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr)) { ver = gestalt_version; } return ver; }
int __stdcall QuickTimeVersion() { long version; OSErr result; // Call the Gestalt manager and ask for QuickTime. If we're lucky, // this should work even in the absence of the QuickTime DLL. result = Gestalt(gestaltQuickTime, &version); return (result == noErr) ? version : 0; }
/* =============== Sys_LoadOpenAL =============== */ bool Sys_LoadOpenAL( void ) { OSErr err; long gestaltOSVersion; err = Gestalt( gestaltSystemVersion, &gestaltOSVersion ); if( err || gestaltOSVersion < 0x1040 ) { return false; } return true; }
long UMAGetSystemVersion() { static SInt32 sUMASystemVersion = 0 ; if ( sUMASystemVersion == 0 ) { verify_noerr(Gestalt(gestaltSystemVersion, &sUMASystemVersion)); } return sUMASystemVersion ; }
void MCScreenDC::boundrect(MCRectangle &rect, Boolean title, Window_mode mode) { MCRectangle srect; if (mode >= WM_MODAL) { const MCDisplay *t_display; t_display = getnearestdisplay(rect); srect = t_display -> workarea; } else srect = MCwbr; uint2 sr, sw, sb, sh; Rect screenRect; SetRect(&screenRect, srect . x, srect . y, srect . x + srect . width, srect . y + srect . height); if (title && mode <= WM_SHEET && mode != WM_DRAWER) { if (mode == WM_PALETTE) screenRect.top += 13; else { long osversion; Gestalt(gestaltSystemVersion, &osversion); if (osversion >= 0x00000800) screenRect.top += 22; else screenRect.top += 19; } sr = sb = 10; sw = 20; sh = 12; } else sr = sw = sb = sh = 0; if (rect.x < screenRect.left) rect.x = screenRect.left; if (rect.x + rect.width > screenRect.right - sr) { if (rect.width > screenRect.right - screenRect.left - sw) rect.width = screenRect.right - screenRect.left - sw; rect.x = screenRect.right - rect.width - sr; } if (rect.y < screenRect.top) rect.y = screenRect.top; if (rect.y + rect.height > screenRect.bottom - sb) { if (rect.height > screenRect.bottom - screenRect.top - sh) rect.height = screenRect.bottom - screenRect.top - sh; rect.y = screenRect.bottom - rect.height - sb; } }
//---------------------------------------------------------------------------------------- //checkMacOSVersion // -figure out if we're running OS-X or not //---------------------------------------------------------------------------------------- void checkMacOSVersion() { UInt32 response; if(Gestalt(gestaltSystemVersion, (SInt32 *) &response) == noErr){ if (response >= 0x1000) gRunningOSX = true; else gRunningOSX = false; } }
static Boolean _checkOSXVersion(void) { long OSXVersion = 0L; OSStatus err = Gestalt(gestaltSystemVersion, &OSXVersion); if (err != noErr) { NSLog(CFSTR("WARNING in GrowlInstallationPrompt: could not get Mac OS X version (selector = %x); got error code %li (will show the installation prompt anyway)"), (unsigned)gestaltSystemVersion, (long)err); //we proceed anyway, on the theory that it is better to show the installation prompt when inappropriate than to suppress it when not. OSXVersion = minimumOSXVersionForGrowl; } return (OSXVersion >= minimumOSXVersionForGrowl); }
extern pascal Boolean MoreRunningOnClassic(void) { UInt32 response; return (Gestalt(gestaltMacOSCompatibilityBoxAttr, (SInt32 *) &response) == noErr) && ((response & (1 << gestaltMacOSCompatibilityBoxPresent)) != 0); }
void SetUpQD(void) { ProcessSerialNumber PSN; FSSpec myFSSpec; Str63 name; ProcessInfoRec infoRec; OSErr result = noErr; CFragConnectionID connID; Str255 errName; // Memorize the plugin¹s resource file refnum for later use. gResFile = CurResFile(); #if !TARGET_API_MAC_CARBON // Ask the system if CFM is available. long response; OSErr err = Gestalt(gestaltCFMAttr, &response); Boolean hasCFM = BitTst(&response, 31-gestaltCFMPresent); if (hasCFM) { // GetProcessInformation takes a process serial number and // will give us back the name and FSSpec of the application. // See the Process Manager in IM. infoRec.processInfoLength = sizeof(ProcessInfoRec); infoRec.processName = name; infoRec.processAppSpec = &myFSSpec; PSN.highLongOfPSN = 0; PSN.lowLongOfPSN = kCurrentProcess; result = GetProcessInformation(&PSN, &infoRec); } else { // If no CFM installed, assume it must be a 68K app. result = -1; } if (result == noErr) { // Now that we know the app name and FSSpec, we can call // GetDiskFragmentto get a connID to use in a subsequent call // to FindSymbol (it will also return the address of ³main² in // app, which we ignore). If GetDiskFragment returns an // error, we assume the app must be 68K. Ptr mainAddr; result = GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName, kReferenceCFrag, &connID, (Ptr*)&mainAddr, errName); } if (result == noErr) { // The app is a PPC code fragment, so call FindSymbol // to get the exported ³qd² symbol so we can access its // QuickDraw globals. CFragSymbolClass symClass; result = FindSymbol(connID, "\pqd", (Ptr*)&gQDPtr, &symClass); } else {
void Traverso::init_sse( ) { bool generic_mix_functions = true; FPU fpu; #if (defined (ARCH_X86) || defined (ARCH_X86_64)) && defined (SSE_OPTIMIZATIONS) if (fpu.has_sse()) { printf("Using SSE optimized routines\n"); // SSE SET Mixer::compute_peak = x86_sse_compute_peak; Mixer::apply_gain_to_buffer = x86_sse_apply_gain_to_buffer; Mixer::mix_buffers_with_gain = x86_sse_mix_buffers_with_gain; Mixer::mix_buffers_no_gain = x86_sse_mix_buffers_no_gain; generic_mix_functions = false; } #elif defined (__APPLE__) && defined (BUILD_VECLIB_OPTIMIZATIONS) long sysVersion = 0; if (noErr != Gestalt(gestaltSystemVersion, &sysVersion)) sysVersion = 0; if (sysVersion >= 0x00001040) { // Tiger at least Mixer::compute_peak = veclib_compute_peak; Mixer::apply_gain_to_buffer = veclib_apply_gain_to_buffer; Mixer::mix_buffers_with_gain = veclib_mix_buffers_with_gain; Mixer::mix_buffers_no_gain = veclib_mix_buffers_no_gain; generic_mix_functions = false; printf("Apple VecLib H/W specific optimizations in use\n"); } #endif /* consider FPU denormal handling to be "h/w optimization" */ setup_fpu (); if (generic_mix_functions) { Mixer::compute_peak = default_compute_peak; Mixer::apply_gain_to_buffer = default_apply_gain_to_buffer; Mixer::mix_buffers_with_gain = default_mix_buffers_with_gain; Mixer::mix_buffers_no_gain = default_mix_buffers_no_gain; printf("No Hardware specific optimizations in use\n"); } }
/***************************************************** * * main (argc, argv) * * Purpose: main program entry point * * Notes: You might want to change this to something more verbose * * Inputs: argc - the number of elements in the argv array * argv - an array of pointers to the parameters to this application * * Returns: int - error code (0 == no error) */ int main(int argc, char* argv[]) { OSStatus status; // Can we run this particular demo application? long response; status = Gestalt(gestaltSystemVersion, &response); Boolean ok = ((noErr == status) && (response >= 0x00001030)); if (!ok) { DialogRef theAlert; CreateStandardAlert(kAlertStopAlert, CFSTR("Mac OS X 10.3 (minimum) is required for this application"), NULL, NULL, &theAlert); RunStandardAlert(theAlert, NULL, NULL); ExitToShell(); } // Create a Nib reference passing the name of the nib file (without the .nib extension) // CreateNibReference only searches into the application bundle. status = CreateNibReference(CFSTR("main"), &gIBNibRef); require_noerr(status, CantGetNibRef); // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar // object. This name is set in InterfaceBuilder when the nib is created. status = SetMenuBarFromNib(gIBNibRef, CFSTR("MenuBar")); require_noerr(status, CantSetMenuBar); // Adding a Font menu MenuRef fontMenu = GetMenuRef(3); require(fontMenu != NULL, CantSetMenuBar); status = CreateStandardFontMenu(fontMenu, 0, 0, 0, NULL); require_noerr(status, CantSetMenuBar); // Enabling Preferences menu item EnableMenuCommand(NULL, kHICommandPreferences); // Let's react to User's commands. Install_AppleEventHandlers(); EventTypeSpec eventTypeCP = {kEventClassCommand, kEventCommandProcess}; InstallEventHandler(GetApplicationEventTarget(), Handle_CommandProcess, 1, &eventTypeCP, NULL, NULL); EventTypeSpec eventTypeCUS = {kEventClassCommand, kEventCommandUpdateStatus}; InstallEventHandler(GetApplicationEventTarget(), Handle_CommandUpdateStatus, 1, &eventTypeCUS, NULL, NULL); EventTypeSpec eventTypeAA = {kEventClassApplication, kEventAppActivated}; InstallEventHandler(GetApplicationEventTarget(), Handle_AppActivated, 1, &eventTypeAA, NULL, NULL); // Call the event loop RunApplicationEventLoop(); CantSetMenuBar: CantGetNibRef: return status; } // main
static short local_AppearanceMgrVersion( void ) { static short apMgrVersion = -1; if ( apMgrVersion == -1 ) { // The first time through, we'll check Gestalt. OSErr err; long result; err = Gestalt( gestaltAppearanceAttr, &result ); if ( ( err == noErr ) && ( result & (1 << gestaltAppearanceExists) ) ) { err = Gestalt( gestaltAppearanceVersion, &result ); if ( err == noErr ) apMgrVersion = LoWord( result ); else apMgrVersion = 0x0100; // Version 1.0 didn't advertise it's version number. } else apMgrVersion = 0x0000; } return apMgrVersion; }
//Determines whether version 4 of QT is installed Boolean wxIsQuickTime4Installed (void) { #ifdef __WXMAC__ short error; long result; error = Gestalt (gestaltQuickTime, &result); return (error == noErr) && (((result >> 16) & 0xffff) >= 0x0400); #else return true; #endif }
pascal UInt32 MoreGetSystemVersion (void) // See comment in header. { if (gSystemVersion == 0) { OSStatus junk; junk = Gestalt(gestaltSystemVersion, (SInt32 *) &gSystemVersion); assert(junk == noErr); } return gSystemVersion; }
// [static] bool XMacSystem::IsSystemVersionOrAbove( SystemVersion inSystemVersion) { SInt32 versionMajor, versionMinor, versionBugFix; OSErr macError; macError = Gestalt( gestaltSystemVersionMajor, &versionMajor); macError = Gestalt( gestaltSystemVersionMinor, &versionMinor); xbox_assert( versionMajor >= 10); switch( inSystemVersion) { case MAC_OSX_10_4: return ((versionMajor == 10) && (versionMinor >= 4)) || (versionMajor > 10); case MAC_OSX_10_5: return ((versionMajor == 10) && (versionMinor >= 5)) || (versionMajor > 10); case MAC_OSX_10_6: return ((versionMajor == 10) && (versionMinor >= 6)) || (versionMajor > 10); case MAC_OSX_10_7: return ((versionMajor == 10) && (versionMinor >= 7)) || (versionMajor > 10); case MAC_OSX_10_8: return ((versionMajor == 10) && (versionMinor >= 8)) || (versionMajor > 10); case MAC_OSX_10_9: return ((versionMajor == 10) && (versionMinor >= 9)) || (versionMajor > 10); case MAC_OSX_10_10: return ((versionMajor == 10) && (versionMinor >= 10)) || (versionMajor > 10); default: return true; } }
// disables time machine static OSStatus DoDisableTM (AuthorizationRef auth, const void * userData, CFDictionaryRef request, CFMutableDictionaryRef response, aslclient asl, aslmsg aslMsg) { assert(auth != NULL); assert(request != NULL); assert(response != NULL); char command[256]; int retValue = 0; // get system version SInt32 major = 0, minor = 0; Gestalt(gestaltSystemVersionMajor, &major); Gestalt(gestaltSystemVersionMinor, &minor); // if Lion or greater if ((major == 10 && minor >= 7) || major >= 11) { sprintf(command,"/usr/bin/tmutil disable"); retValue = system(command); // disabling local backups causes any stored local backups // to be deleted, this option is left here in case someone // actually wants to do that /* if (!retValue) { sprintf(command,"/usr/bin/tmutil disablelocal"); retValue = system(command); } */ } else { // Snow leopard sprintf(command,"/usr/bin/defaults write /Library/Preferences/com.apple.TimeMachine.plist %s %s %s", "AutoBackup", "-boolean", "FALSE"); retValue = system(command); } return retValue; }
static OpenMSOSInfo getOSInfo() { OpenMSOSInfo info; #if defined(WIN32) // Windows info.os = OS_WINDOWS; info.arch = getArchOnWin(); info.os_version = getWinOSVersion(); #elif (defined(__MACH__) && defined(__APPLE__)) // MacOS info.os = OS_MACOS; // check if we can use QSysInfo #if defined(Q_WS_MAC) // query gestalt for detailed osx version information // NOTE: Gestalt will be deprecated at some point in the future where we // have to look for a better solution SInt32 majorVersion,minorVersion,bugFixVersion; Gestalt(gestaltSystemVersionMajor, &majorVersion); Gestalt(gestaltSystemVersionMinor, &minorVersion); Gestalt(gestaltSystemVersionBugFix, &bugFixVersion); info.os_version = String(majorVersion) + "." + String(minorVersion) + String(".") + String(bugFixVersion); // identify architecture if (QSysInfo::WordSize == 32) { info.arch = ARCH_32BIT; } else { info.arch = ARCH_64BIT; } #endif #else //Linux info.os = OS_LINUX; //TODO #endif return info; }