The OS X detection a compile-time decision, so using preprocessor branch would be better, in this case the following:

    #ifdef __APPLE__
    // ...
    #else
    // ...
    #endif

Then you also don't need to indent the code inside (so the original non-OSX code will appear unchanged in the diff).