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:
+19
-2
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user