diff options
author | ritsuka <[email protected]> | 2014-07-19 08:22:28 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-07-19 08:22:28 +0000 |
commit | 8eba50b3ff98e419cad4cc1753877292c82b21dd (patch) | |
tree | 9a7a49f5a287ebc431315d5029b5c8b79eecd443 | |
parent | 55f24a37ee63b4bee9444a8a745c507c7ad551eb (diff) |
MacGui: Used a different api in HBDVDDetector to avoid DiskArbitration crashes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6238 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/HBDVDDetector.m | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/macosx/HBDVDDetector.m b/macosx/HBDVDDetector.m index 97b4802a1..6d12ed64e 100644 --- a/macosx/HBDVDDetector.m +++ b/macosx/HBDVDDetector.m @@ -10,7 +10,7 @@ #include <IOKit/IOKitLib.h> #include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IODVDMedia.h> -#include <DiskArbitration/DiskArbitration.h> +#include <sys/mount.h> #import "HBDVDDetector.h" @@ -80,29 +80,17 @@ return bsdName; } - NSURL *volumeURL = [NSURL fileURLWithPath:path]; + struct statfs s; + statfs([path fileSystemRepresentation], &s); - // Create a DADiskRef - DASessionRef session = DASessionCreate(kCFAllocatorDefault); - DADiskRef disk = DADiskCreateFromVolumePath(kCFAllocatorDefault, - session, - (CFURLRef)volumeURL); + bsdName = [NSString stringWithUTF8String:s.f_mntfromname]; - if ( disk ) + if ([bsdName hasPrefix:@"/dev/"]) { - CFDictionaryRef desc = DADiskCopyDescription(disk); - if ( desc ) - { - // Get the bsd name from it - bsdName = [(NSString *)CFDictionaryGetValue(desc, kDADiskDescriptionMediaBSDNameKey) retain]; - CFRelease(desc); - } - CFRelease(disk); + bsdName = [bsdName stringByReplacingCharactersInRange:NSMakeRange(0, 5) withString:@""]; } - CFRelease(session); - - return bsdName; + return [bsdName retain]; } |