From dc0d4fcf303458e9044866dd05a30c317e07eef0 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 3 Oct 2015 13:18:18 -0400 Subject: [PATCH] BACKENDS: Add support for opening a CD on Mac OS X by path or drive --- backends/audiocd/macosx/macosx-audiocd.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backends/audiocd/macosx/macosx-audiocd.cpp b/backends/audiocd/macosx/macosx-audiocd.cpp index a8ba712621e..76bae955005 100644 --- a/backends/audiocd/macosx/macosx-audiocd.cpp +++ b/backends/audiocd/macosx/macosx-audiocd.cpp @@ -52,6 +52,7 @@ public: protected: bool openCD(int drive); + bool openCD(const Common::String &drive); private: struct Drive { @@ -135,6 +136,24 @@ bool MacOSXAudioCDManager::openCD(int drive) { return findTrackNames(cddaDrives[drive].mountPoint); } +bool MacOSXAudioCDManager::openCD(const Common::String &drive) { + closeCD(); + + DriveList drives = detectAllDrives(); + + for (uint32 i = 0; i < drives.size(); i++) { + if (drives[i].fsType != "cddafs") + continue; + + if (drives[i].mountPoint == drive || drives[i].deviceName == drive) { + debug(1, "Using '%s' as the CD drive", drives[i].mountPoint.c_str()); + return findTrackNames(drives[i].mountPoint); + } + } + + return false; +} + void MacOSXAudioCDManager::closeCD() { stop(); _trackMap.clear();