PlatformUtilities::getTypeOfFile and 10.4 (Tiger)


#1

I had a crash report, which turned out to be a JUCE bug. In juce_mac_Files.mm, PlatformUtilities::getTypeOfFile the code is conditioned based on MAC_OS_X_VERSION_MAX_ALLOWED, which leads “selector not recognized” on Tiger, since attributesOfItemAtPath isn’t available on 10.4.

I’ve replaced MAC_OS_X_VERSION_MAX_ALLOWED with MAC_OS_X_VERSION_MIN_REQUIRED, although a better solution would check the OS version at runtime.

#if JUCE_IPHONE || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; #else NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; #endif

Same fix was applied to File::getLinkedTarget.


#2

Thanks, but I actually fixed that some time ago - always worth checking the latest build when you see a bug!


#3

True. I actually checked the tip before posting and didn’t see a fix. The only change was that JUCE_IPHONE was replaced with JUCE_IOS. Here is the tip code:

#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; #else NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; #endif


#4

Ah, sorry - I misread your email and thought you were posting a fix rather than the original code. Yes, you’re quite right, I’ll sort that out, thanks!