mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
OSX: fix unmounting drives that have APFS volumes
- If a drive is formatted APFS it will have a seperate disk devices for physical drive (e.g. /dev/disk2) and volumes (e.g. /dev/disk3). Need to unmount all, or opening the device for writing will subsequently fail. (User will see an "Error running authopen" error in Imager in that case). - Also do not show APFS volumes seperately in the disk selection dialog. List mount points under physical drive instead. Closes #501
This commit is contained in:
parent
9d4665dbca
commit
30225187bd
5 changed files with 100 additions and 4 deletions
|
@ -111,12 +111,29 @@ QByteArray DownloadThread::_fileGetContentsTrimmed(const QString &filename)
|
|||
|
||||
bool DownloadThread::_openAndPrepareDevice()
|
||||
{
|
||||
emit preparationStatusUpdate(tr("opening drive"));
|
||||
|
||||
if (_filename.startsWith("/dev/"))
|
||||
{
|
||||
emit preparationStatusUpdate(tr("unmounting drive"));
|
||||
#ifdef Q_OS_DARWIN
|
||||
/* Also unmount any APFS volumes using this physical disk */
|
||||
auto l = Drivelist::ListStorageDevices();
|
||||
for (const auto &i : l)
|
||||
{
|
||||
if (QByteArray::fromStdString(i.device) == _filename)
|
||||
{
|
||||
for (const auto &j : i.childDevices)
|
||||
{
|
||||
qDebug() << "Unmounting APFS volume:" << j.c_str();
|
||||
unmount_disk(j.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
qDebug() << "Unmounting:" << _filename;
|
||||
unmount_disk(_filename.constData());
|
||||
}
|
||||
emit preparationStatusUpdate(tr("opening drive"));
|
||||
|
||||
_file.setFileName(_filename);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue