From 355e7bc69c3f787ce46c1080b4be55e79306a7b2 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Fri, 28 Aug 2015 09:45:02 +0200 Subject: [osx/darwinutils] - add method IsLion to check for 10.7.x runtime --- xbmc/osx/DarwinUtils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/osx/DarwinUtils.h b/xbmc/osx/DarwinUtils.h index 77635489fe..0a0423edc1 100644 --- a/xbmc/osx/DarwinUtils.h +++ b/xbmc/osx/DarwinUtils.h @@ -33,6 +33,7 @@ public: static const char *getIosPlatformString(void); static bool IsAppleTV2(void); static bool IsMavericks(void); + static bool IsLion(void); static bool IsSnowLeopard(void); static bool DeviceHasRetina(double &scale); static const char *GetOSReleaseString(void); -- cgit v1.2.3 From 1d26a1ff992b2eb76ebbea071cfae5e1ed109c35 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Fri, 28 Aug 2015 09:46:46 +0200 Subject: [osx/darwinutils] - add implementation for IsLion to determine 10.7.x runtime --- xbmc/osx/DarwinUtils.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xbmc/osx/DarwinUtils.mm b/xbmc/osx/DarwinUtils.mm index 75ece9f8b5..b1b282f5d1 100644 --- a/xbmc/osx/DarwinUtils.mm +++ b/xbmc/osx/DarwinUtils.mm @@ -212,6 +212,20 @@ bool CDarwinUtils::IsMavericks(void) return isMavericks == 1; } +bool CDarwinUtils::IsLion(void) +{ + static int isLion = -1; +#if defined(TARGET_DARWIN_OSX) + if (isLion == -1) + { + double appKitVersion = floor(NSAppKitVersionNumber); + // everything lower 10.8 is 10.7.x because 10.7 is deployment target... + isLion = (appKitVersion < NSAppKitVersionNumber10_8) ? 1 : 0; + } +#endif + return isLion == 1; +} + bool CDarwinUtils::IsSnowLeopard(void) { static int isSnowLeopard = -1; -- cgit v1.2.3 From 896511cb1bd03a0927903f5f65f8c572129e8154 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Fri, 28 Aug 2015 09:49:21 +0200 Subject: [osx] - on 10.7.x runtime never call Cocoa_GetVolumeNameFromMountPoint as it crashes --- xbmc/storage/osx/DarwinStorageProvider.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xbmc/storage/osx/DarwinStorageProvider.cpp b/xbmc/storage/osx/DarwinStorageProvider.cpp index 6be9ab13cd..19c99b7ef2 100644 --- a/xbmc/storage/osx/DarwinStorageProvider.cpp +++ b/xbmc/storage/osx/DarwinStorageProvider.cpp @@ -29,6 +29,7 @@ #include #include #include +#include "osx/DarwinUtils.h" #endif #include "osx/CocoaInterface.h" @@ -62,6 +63,9 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives) share.strName = "Volumes"; share.m_ignore = true; localDrives.push_back(share); + + if (CDarwinUtils::IsLion()) + return; //temp workaround for crash in Cocoa_GetVolumeNameFromMountPoint on 10.7.x // This will pick up all local non-removable disks including the Root Disk. DASessionRef session = DASessionCreate(kCFAllocatorDefault); @@ -106,6 +110,10 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives) void CDarwinStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives) { #if defined(TARGET_DARWIN_OSX) + + if (CDarwinUtils::IsLion()) + return; //temp workaround for crash in Cocoa_GetVolumeNameFromMountPoint on 10.7.x + DASessionRef session = DASessionCreate(kCFAllocatorDefault); if (session) { -- cgit v1.2.3