mirror of https://github.com/PCSX2/pcsx2.git
CDVD: simplify code
This commit is contained in:
parent
ec8712cceb
commit
616da8c99d
|
@ -41,8 +41,7 @@ std::vector<std::string> GetDriveListFromClasses(CFMutableDictionaryRef classes)
|
||||||
result = IOServiceGetMatchingServices(kIOMasterPortDefault, classes, &iterator);
|
result = IOServiceGetMatchingServices(kIOMasterPortDefault, classes, &iterator);
|
||||||
if (result != KERN_SUCCESS)
|
if (result != KERN_SUCCESS)
|
||||||
return drives;
|
return drives;
|
||||||
io_object_t media = IOIteratorNext(iterator);
|
while (io_object_t media = IOIteratorNext(iterator))
|
||||||
while (media)
|
|
||||||
{
|
{
|
||||||
CFTypeRef path_cfstr = IORegistryEntryCreateCFProperty(media, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0);
|
CFTypeRef path_cfstr = IORegistryEntryCreateCFProperty(media, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0);
|
||||||
if (path_cfstr)
|
if (path_cfstr)
|
||||||
|
@ -58,7 +57,6 @@ std::vector<std::string> GetDriveListFromClasses(CFMutableDictionaryRef classes)
|
||||||
CFRelease(path_cfstr);
|
CFRelease(path_cfstr);
|
||||||
}
|
}
|
||||||
IOObjectRelease(media);
|
IOObjectRelease(media);
|
||||||
media = IOIteratorNext(iterator);
|
|
||||||
}
|
}
|
||||||
IOObjectRelease(iterator);
|
IOObjectRelease(iterator);
|
||||||
return drives;
|
return drives;
|
||||||
|
@ -71,15 +69,13 @@ std::vector<std::string> GetOpticalDriveList()
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
std::vector<std::string> drives;
|
std::vector<std::string> drives;
|
||||||
|
|
||||||
CFMutableDictionaryRef cd_classes = IOServiceMatching(kIOCDMediaClass);
|
if (CFMutableDictionaryRef cd_classes = IOServiceMatching(kIOCDMediaClass))
|
||||||
if (cd_classes)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> cd = GetDriveListFromClasses(cd_classes);
|
std::vector<std::string> cd = GetDriveListFromClasses(cd_classes);
|
||||||
drives.insert(drives.end(), cd.begin(), cd.end());
|
drives.insert(drives.end(), cd.begin(), cd.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
CFMutableDictionaryRef dvd_classes = IOServiceMatching(kIODVDMediaClass);
|
if (CFMutableDictionaryRef dvd_classes = IOServiceMatching(kIODVDMediaClass))
|
||||||
if (dvd_classes)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> dvd = GetDriveListFromClasses(dvd_classes);
|
std::vector<std::string> dvd = GetDriveListFromClasses(dvd_classes);
|
||||||
drives.insert(drives.end(), dvd.begin(), dvd.end());
|
drives.insert(drives.end(), dvd.begin(), dvd.end());
|
||||||
|
|
Loading…
Reference in New Issue