Hi, I wrote some code especially for macOS as target with #if JUCE_MAC
Is there a way to target certain code for certain macOS versions?
Let’s say some code for Monterey and a variation for Sonoma
Thanks and happy Holidays ![]()
Damien
Hi, I wrote some code especially for macOS as target with #if JUCE_MAC
Is there a way to target certain code for certain macOS versions?
Let’s say some code for Monterey and a variation for Sonoma
Thanks and happy Holidays ![]()
Damien
In ObjC there’s an @available mechanism, I’m no expert on ObjC though
Simple use juce::SystemStats::getOperatingSystemType
auto type = juce::SystemStats::getOperatingSystemType ();
if ( type == juce::SystemStats::OperatingSystemType::MacOS_14 )
{
// Do something magical in Sonoma
}
else if ( type == juce::SystemStats::OperatingSystemType::MacOS_13 )
{
// Do something banal in Ventura
}
There doesn’t seem to be an enum for Sequoia…
Thank you so much @reFX !
I was even doing a mistage pointing to #if JUCE_MAC because this one was just a top level filter for targeted system when compiling.
juce::SystemStats::getOperatingSystemType is exactly what I was looking for to be able to change properties depending on the running OS.
Happy Holidays mate,thanks for your precious help ![]()
Damien
Good catch, I’ll add the enum.