getUSBMountPath(): check for directory 'dirPathUnderMountPath' under mount path.

This commit is contained in:
Gerhard Hoffmann 2024-05-14 12:48:19 +02:00
parent a3a4c09c7f
commit 4536284f34

View File

@ -274,8 +274,7 @@ std::optional<QString> System::checkForUSBStick(QString const &dirPathUnderMount
* Note, do not return an empty string ("") here because a calling method (which could not be
* identified till now) is relying on this!
*/
QString System::getUSBMountPath()
{
QString System::getUSBMountPath(QString const &dirPathUnderMountPath) {
#if defined (ARCH_DesktopLinux)
// DEBUG / TEST:
@ -316,8 +315,13 @@ QString System::getUSBMountPath()
mountLine = line.split(' ');
if (mountLine.size() > 3) {
qDebug() << "System::getUSBMountPath(): " << mountLine.at(0) << " is mounted on " << mountLine.at(2);
return mountLine.at(2);
qCritical() << "System::getUSBMountPath(): " << mountLine.at(0) << " is mounted on " << mountLine.at(2);
QDir d(QDir::cleanPath(mountLine.at(2) + QDir::separator() + dirPathUnderMountPath));
if (d.exists()) {
return mountLine.at(2);
} else {
qCritical() << "directory" << d.absolutePath() << "does not exist";
}
}
}
}