|
|
|
|
@ -382,7 +382,13 @@ void reHDD::filterIgnoredDrives(list<Drive> *plistDrives)
|
|
|
|
|
list<Drive>::iterator it;
|
|
|
|
|
for (it = plistDrives->begin(); it != plistDrives->end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
if (it->getPath().find(systemDrivePath) != std::string::npos) // compare found system drive and current drive
|
|
|
|
|
string driveName = it->getPath();
|
|
|
|
|
// Remove /dev/ prefix
|
|
|
|
|
if (driveName.find("/dev/") == 0)
|
|
|
|
|
{
|
|
|
|
|
driveName = driveName.substr(5); // Skip "/dev/"
|
|
|
|
|
}
|
|
|
|
|
if (systemDrivePath.find(driveName) != std::string::npos) // compare found system drive and current drive
|
|
|
|
|
{
|
|
|
|
|
// system drive found --> ignore this drive
|
|
|
|
|
#ifdef LOG_LEVEL_HIGH
|
|
|
|
|
@ -709,14 +715,23 @@ bool reHDD::getSystemDrive(string &systemDrive)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Logger::logThis()->info(currentLine);
|
|
|
|
|
|
|
|
|
|
// Extract drive name from line (removing tree characters)
|
|
|
|
|
if ((cLine[0U] != '|') && (cLine[0U] != '`'))
|
|
|
|
|
{
|
|
|
|
|
systemDrive = currentLine;
|
|
|
|
|
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), '\n'), systemDrive.end()); // remove newline
|
|
|
|
|
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), ' '), systemDrive.end()); // remove spaces
|
|
|
|
|
// Logger::logThis()->info("Drive found: " + systemDrive);
|
|
|
|
|
|
|
|
|
|
// Find the actual drive name (after tree characters like └─, ├─)
|
|
|
|
|
size_t lastAlpha = 0;
|
|
|
|
|
for (size_t i = 0; i < systemDrive.length(); i++)
|
|
|
|
|
{
|
|
|
|
|
if (isalpha(systemDrive[i]))
|
|
|
|
|
{
|
|
|
|
|
lastAlpha = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
systemDrive = systemDrive.substr(lastAlpha);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentLine.ends_with(" /boot/efi\n"s))
|
|
|
|
|
@ -739,5 +754,17 @@ bool reHDD::getSystemDrive(string &systemDrive)
|
|
|
|
|
}
|
|
|
|
|
pclose(outputfileHwinfo);
|
|
|
|
|
|
|
|
|
|
// Remove mountpoint (everything after first space)
|
|
|
|
|
size_t spacePos = systemDrive.find(' ');
|
|
|
|
|
if (spacePos != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
systemDrive = systemDrive.substr(0, spacePos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove all unwanted characters
|
|
|
|
|
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), '\n'), systemDrive.end());
|
|
|
|
|
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), '/'), systemDrive.end());
|
|
|
|
|
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), '\r'), systemDrive.end());
|
|
|
|
|
|
|
|
|
|
return systemDriveFound;
|
|
|
|
|
}
|
|
|
|
|
|